The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Catalyst::Plugin::Config::Perl - use Config::MorePerl with catalyst.

SYNOPSIS

See Config::MorePerl for synopsis of config files.

    use Catalyst 'Config::Perl';

    ...
    
    $cfg = $myapp->config;
    $cfg = $myapp->cfg; # the same but much faster
    if ($myapp->dev) { ... } # alias for $myapp->cfg->{dev}
    
    ...
    
    $c->config_reload; # read configs again
    my $fresh_config = $c->cfg;

DESCRIPTION

This plugin automatically processes configs via Config::MorePerl's process passing local.conf as starting config file if it exists. If it doesn't, conf/[myapp].conf is used.

If you want other file to be used, set file option of this module's config before setup phase. For example:

    MyApp->config->{'Plugin::Config::Perl'}{file} = 'conf/myfile.conf'; # path is relative to the project's dir

This plugin passes MyApp-config> as an initial config for Config::MorePerl's process.

This plugin is a new version of Catalyst::Plugin::ConfigLoader::MultiState.

METHODS

dev

Development server flag. $c->dev is true if current installation is development. Also available through $c->cfg->{dev}.

cfg

Fast accessor for getting config hash. It is 30x faster than original ->config accessor.

config_reload

Reads configs again using the same initial config as it was for the first time. Updates $c->config and $c->cfg.

config_initial

The content of $c->config before the first processing of configs. You can change it to reload configs using another initial values.

setup

Called by catalyst at setup phase. Initializes config.

finalize_config

This method is called after the config file has been processed. It can be used to implement tuning of config values that can only be done at runtime.

Startup perfomance

    It takes about 9ms to initialize config system with 30 files (225kb summary) on Core i7 3930K.

SEE ALSO

Catalyst::Runtime, Catalyst::Plugin::ConfigLoader, Catalyst::Plugin::ConfigLoader::MultiState

AUTHOR

Pronin Oleg <syber@cpan.org>

Crazy Panda LTD

LICENSE

You may distribute this code under the same terms as Perl itself.