CatalystX::Crudite::Manual::Cookbook - Miscellaneous recipes
In all recipes, replace strings like MyApp, myapp and MYAPP with the appropriately cased versions of your actual web application name.
MyApp
myapp
MYAPP
Problem: You want to use several configurations, for example, for testing, staging and production environments.
Solution: Use the standard Catalyst::Plugin::ConfigLoader mechanisms.
Catalyst::Plugin::ConfigLoader
Create a configuration file myapp_test.yaml:
myapp_test.yaml
Model::DB: connect_info: dsn: "DBI:Pg:database=myapp_test;host=localhost" user: foobar password: foobar
and another file myapp_stage.yaml:
myapp_stage.yaml
Model::DB: connect_info: dsn: "DBI:Pg:database=myapp_stage;host=localhost" user: foobar password: foobar
And so on for each of your deployment environments. Now you can choose which configuration file to use by setting a special environment variable to the file name suffix:
export MYAPP_CONFIG_LOCAL_SUFFIX=test export MYAPP_CONFIG_LOCAL_SUFFIX=stage
The configuration in these files overrides your global configuration that is stored in lib/MyApp.pm.
lib/MyApp.pm
To install CatalystX::Crudite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::Crudite
CPAN shell
perl -MCPAN -e shell install CatalystX::Crudite
For more information on module installation, please visit the detailed CPAN module installation guide.