Handel::ConfigReader can read in Handel configuration settings from ENV/ModPerl.
SYNOPSIS
use Handel::ConfigReader;
my $cfg = Handel::ConfigReader->instance();
my $setting = $cfg->get('HandelMaxQuantity');
my $other = $cfg->{'OtherSetting'};
Handel::ConfigReader is a generic wrapper to get various configuration values. As some point this will probably get worked into XS/custom httpd.conf directives.
Each configuration object is also a tied hash. The two usages are the same:
my $cfg = Handel::ConfigReader->instance();
my $setting = $cfg->get('Setting');
my $setting = $cfg->{'Setting'};
The latter is the preferred usage in anticipation of also integrating Apache::ModuleConfig and custom directives which use the same hash syntax.
CONSTRUCTOR
new
Returns a new Handel::ConfigReader instance.
my $cfg = Handel::ConfigReader->new();
instance
Returns the same Handel::ConfigReader instance for each call.
my $cfg = Handel::ConfigReader->instance();
METHODS
get
Arguments: $key [, $default]
Returns the configured value for the key specified. You can use this as an instance method or as a simpleton:
my $cfg = Handel::ConfigReader->instance();
my $setting = $cfg->get('HandelMaxQuantity');
my $cfg = Handel::ConfigReader->instance();
my $setting = $cfg->get('HandelMaxQuantity');
You can also pass a default value as the second parameter. If no value is loaded for the key specified, the default value will be returned instead.
my $cfg = Handel::ConfigReader->instance();
my $setting = $cfg->get('DoesNotExist', 'foo');
print $setting; # foo
FETCH
Arguments: $key
Returns an item form the configuration via tied hash.
my $cfg = Handel::ConfigReader->new;
my $setting = $cfg->{'MySetting'};
EXISTS
Arguments: $key
Returns true if the specified setting returns a defined value.
my $cfg = Handel::ConfigReader->new;
if (exists $cfg->{'MySetting'}) {
...
};
Product's homepage
Requirements:
· Perl