NAME
Catalyst::Plugin::Config::Perl - use Panda::Config::Perl with catalyst.
SYNOPSIS
See Panda::Config::Perl 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}
DESCRIPTION
This plugin automatically processes configs via Panda::Config::Perl'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 Panda::Config::Perl'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.
- 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, CP Decision LTD
LICENSE
You may distribute this code under the same terms as Perl itself.