NAME
Handel::ConfigReader - Read in Handel configuration settings
SYNOPSIS
use Handel::ConfigReader;
my $cfg = Handel::ConfigReader-new();
my $setting = $cfg->get('HandelMaxQuantity');
DESCRIPTION
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.
Starting in version 0.11, each instance is also a tied hash. The two usages are the same:
my $cfg = Handel::ConfigReader->new();
my $setting = $cfg->get('Setting');
my $setting = $cfg->{'Setting'};
Thie latter is the preferred usage in anticipation of als integrating Apache::ModuleConfig and custom directives which use the same hash syntax.
CONSTRUCTOR
new
Returns a new Handel::ConfigReader object.
my $cfg = Handel::ConfigReader->new();
METHODS
get($key [, $default])
Returns the configured value for the key specified. You can use this as an instance method or as a simpleton:
my $setting = Handel::ConfigReader->get('HandelMaxQuantity');
my $cfg = Handel::ConfigReader->new();
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.
CONFIGURATION
Various Handel runtime options can be set via %ENV
variables, or using PerlSetVar
when running under mod_perl
.
HandelMaxQuantity
PerlSetVar HandelMaxQuantity 32
...
$ENV{HandelMaxQuantity} = 32;
If defined, this sets the maximum quantity allowed for each Handel::Cart::Item
in the shopping cart. By default, when the user request more than HandelMaxQuantity
, quantity
is reset to HandelMaxQuantity
. If you would rather raise an Handel::Exception::Constraint
instead, see HandelMaxQuantityAction
below.
HandelMaxQuantityAction (Adjust|Exception)
This option defines what action should be taken when a cart items quantity is being set to something above HandelMaxQuantity
. When set to Adjust
the quantity qill simple be reset to HandelMaxQuantity
and no exception will be raised. This is the default action.
When set to <Exception> and the quantity requested is greater than HandelMaxQuantity
, a Handel::Exception::Constraint
exception is thrown.
HandelCurrencyCode
This sets the default currency code used when no code is passed into format
. See Locale::Currency::Format for all available currency codes. The default code is USD.
HandelCurrencyFormat
This sets the default options used to format the price. See Locale::Currency::Format for all available currency codes. The default format used is FMT_STANDARD
. Just like in Locale::Currency::Format
, you can combine options using |
.
HandelDBIDriver
The name of the DBD driver. Defaults to mysql
.
HandelDBIHost
The name of the database server. Defaults to localhost
.
HandelDBIPort
The port of the database server. Defaults to 3306
.
HandelDBIName
The name of the database. Defaults to commerce
.
HandelDBIUser
The user name used to connect to the server. Defaults to commerce
.
HandelDBIPassword
The password used to connect to the server. Defaults to commerce
.
HandelPluginPaths
This resets the checkout plugin search path to a namespace of your choosing, The default plugin search path is Handel::Checkout::Plugin::*
PerlSetVar HandelPluginPaths MyApp::Plugins
In the example above, the checkout plugin search path will load all plugins in the MyApp::Plugins::* namespace (but not MyApp::Plugin itself). Any plugins in Handel::Checkout::Plugin::* will be ignored.
You can also pass a comma or space seperate list of namespaces.
PerlSetVar HandelPluginPaths 'MyApp::Plugins, OtherApp::Plugins'
Any plugin found in the search path that isn't a subclass of Handel::Checkout::Plugin will be ignored.
HandelAddPluginPaths
This adds an additional plugin search paths. This can be a comma or space seperated list of namespaces.
PerlSetVar HandelAddPluginPaths 'MyApp::Plugins, OtherApp::Plugins'
In the example above, when a checkout process is loaded, it will load all plugins in the Handel::Checkout::Plugin::*, MyApp::Plugins::*, and OtherApp::Plugins namespaces.
Any plugin found in the search path that isn't a subclass of Handel::Checkout::Plugin will be ignored.
AUTHOR
Christopher H. Laco
CPAN ID: CLACO
claco@chrislaco.com
http://today.icantfocus.com/blog/