NAME

Pangloss::Config - config singleton for Pangloss.

SYNOPSIS

use Pangloss::Config;

# get config vars from %ENV (if not already set):
my $C = Pangloss::Config->new( \%ENV );

print "pangloss home is: $C->{PG_HOME}\n" if $C->{PG_DEBUG};

# force parsing:
$C->parse_hash( $some_hash );

DESCRIPTION

Configuration hash for Pangloss, implemented as a singleton.

CONFIG VARS

Config Variable     [ default value ]
----------------------------------------------------
PG_DEBUG            [ 0 ]
PG_HOME             [ /path/to/current/dir ]
PG_CONFIG_FILE      [ $PG_HOME/conf/controller.yml ]
PG_TEMPLATE_DIR     [ $PG_HOME/web ]
PG_TEMPLATE_TYPE    [ petal ]
PG_SESSION_TYPE     [ file_cache ]
PG_SESSION_EXPIRY   [ 15 minutes ]
PG_PIXIE_DSN        [ dbi:mysql:dbname=pangloss ]
PG_PIXIE_USER       [ ]
PG_PIXIE_PASS       [ ]

CONSTRUCTOR

$class->new( [ $hash ] )

create a new Config singleton (unless one exists already) and return it. If the singleton is being created it is initialized with values from $hash, otherwise the defaults are used.

METHODS

$obj = $obj->parse_hash( $hash )

set the config object's params from the hash given, or use the default value.

@vars = $obj->config_vars

get the list of config variables available.

$val = $obj->get_default_for( $config_var )

get the default value of the $config_var named.

$class = $class->set_default_for( $config_var => $code_ref )

set the default value of the $config_var to the $code_ref given. The $code_ref should expect the current object as its first param.

AUTHOR

Steve Purkis <spurkis@quiup.com>

SEE ALSO

Pangloss