MOSES::MOBY::Config - A hash based configuration module based on Config::Simple
# use config allong with the MOSES config file use MOSES::MOBY::Config; # use config along with my properties.file use MOSES::MOBY::Config qw /'properties.file'/; # print the successfully read config files foreach my $file (MOSES::MOBY::Config->ok_files) { print "\t$file - successfully processed\n"; } # print a list of files that failed to load my %failed = MOSES::MOBY::Config->failed_files; if (keys %failed > 0) { print "Failed configuration files:\n"; foreach my $file (sort keys %failed) { my $msg = $failed{$file}; $msg =~ s/\n$//; print "\t$file => $msg\n"; } } # print out the config params read thus far print "All configuration parameters:\n"; foreach my $name (sort MOSES::MOBY::Config->param()) { print "\t$name => " . MOSES::MOBY::Config->param ($name); }
A module for reading configuration files and maintaining configuration parameters
Martin Senger (martin.senger [at] gmail [dot] com) Edward Kawas (edward.kawas [at] gmail [dot] com)
Instantiates a new MOSES::MOBY::Config reference. Mainly here for OO access. There are no instance attributes, only class attributes
If called with no arguments, all of the possible config keys are returned. If called with a single argument, then that argument is assumed to be a key and the value for that key is returned.
removes one or more of the configuration keys and their associated values.
Returns a stringified version of all configuration parameters;
If passed a scalar parameter, then the dump will be given that variable name. This dump can be eval{}'ed.
returns a list of the configuration files successfully read thus far ...
returns a hash of the configuration files unsuccessfully read thus far and their corresponding error messages.
To install MOSES::MOBY, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MOSES::MOBY
CPAN shell
perl -MCPAN -e shell install MOSES::MOBY
For more information on module installation, please visit the detailed CPAN module installation guide.