Catalyst::Plugin::ConfigLoader::Multi - Catalyst Plugin for Multiple ConfigLoader
package MyApp; use strict; use warnings; use Catalyst::Runtime '5.70'; use Catalyst qw/-Debug ConfigLoader::Multi/; our $VERSION = '0.01'; __PACKAGE__->config( name => 'MyApp' ); # Do not forget add this. __PACKAGE__->config( 'Plugin::ConfigLoader' => { file => __PACKAGE__->path_to('conf') } ); __PACKAGE__->setup; 1;
Your directory
%tree /Users/tomyhero/work/MyApp/ |-- Changes |-- Makefile.PL |-- README |-- conf | |-- my_app_local.yml | |-- myapp.yml | |-- myapp_bar.yml | `-- myapp_foo.yml |-- lib | |-- MyApp | | |-- Controller | | | `-- Root.pm | | |-- Model | | `-- View | `-- MyApp.pm |-- root |-- script `-- t
When a project is getting bigger and bigger , it is hard to organize a config file. So we create this plugin which divide a config file to multiple. Config files name must start your project prefix. such as 'myapp_' .
__PACKAGE__->config( 'Plugin::ConfigLoader' => { file => __PACKAGE__->path_to('conf') } );
Do not forget add this code to your MyApp.pm
override from ConfigLoader
you can specify local file with this setting.( you must use local_sufix for the file name )
$ENV{MYAPP_CONFIG_MULTI} = '/tmp/foo/your_own_local.yaml'
Catalyst::Plugin::ConfigLoader
Masahiro Funakoshi <masap@cpan.org>
Yu-suke Amano
Tomohiro Teranishi <tomohiro.teranishi@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::Plugin::ConfigLoader::Multi, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::Plugin::ConfigLoader::Multi
CPAN shell
perl -MCPAN -e shell install Catalyst::Plugin::ConfigLoader::Multi
For more information on module installation, please visit the detailed CPAN module installation guide.