Catalyst::Plugin::Config::Perl - use Config::MorePerl with catalyst.
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;
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.
process
local.conf
conf/[myapp].conf
If you want other file to be used, set file option of this module's config before setup phase. For example:
file
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.
MyApp-
This plugin is a new version of Catalyst::Plugin::ConfigLoader::MultiState.
Development server flag. $c->dev is true if current installation is development. Also available through $c->cfg->{dev}.
Fast accessor for getting config hash. It is 30x faster than original ->config accessor.
Reads configs again using the same initial config as it was for the first time. Updates $c->config and $c->cfg.
The content of $c->config before the first processing of configs. You can change it to reload configs using another initial values.
reload
Called by catalyst at setup phase. Initializes 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.
It takes about 9ms to initialize config system with 30 files (225kb summary) on Core i7 3930K.
Catalyst::Runtime, Catalyst::Plugin::ConfigLoader, Catalyst::Plugin::ConfigLoader::MultiState
Pronin Oleg <syber@cpan.org>
Crazy Panda LTD
You may distribute this code under the same terms as Perl itself.
To install Catalyst::Plugin::Config::Perl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::Config::Perl
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::Config::Perl
For more information on module installation, please visit the detailed CPAN module installation guide.