NAME
MOSES::MOBY::Config - A hash based configuration module based on Config::Simple
SYNOPSIS
# 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);
}
DESCRIPTION
A module for reading configuration files and maintaining configuration parameters
AUTHORS
Martin Senger (martin.senger [at] gmail [dot] com)
Edward Kawas (edward.kawas [at] gmail [dot] com)
SUBROUTINES
new
Instantiates a new MOSES::MOBY::Config reference. Mainly here for OO access. There are no instance attributes, only class attributes
param
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.
delete
removes one or more of the configuration keys and their associated values.
dump
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.
ok_files
returns a list of the configuration files successfully read thus far ...
failed_files
returns a hash of the configuration files unsuccessfully read thus far and their corresponding error messages.