Category: Catalyst
Config Catalyst
April 27th, 2009Catalyst Configure Schema
1, App class will load config option into self.
2, Other class query App class about its config option. For example, Model::DB will try to query its option in $config->{Model}->{DB}.
3, Catalyst default uses Config::General to load config from {app_name}.conf
4, Class can setup configure item in its source file by __PACKAGE__->config( {info} ), and this config function will return the current package level configure options.
Local config
By default, Catalyst try to local appname.conf, but it also try to load a local config file: appname_local.conf, which contains high priority value than appname.conf.
The __PACKAGE__->config() has lowest priority.
So use __PACKAGE__->config() to setup default configuration.
Use appname.conf to setup configure wish included into version manager system.
Use appname_local.conf to complete items in release mode.
User can use envoriment variable CONFIG_LOCAL_SUFFIX to change 'local' to other value.
Config::General config format
<name1> will map to a named field: $parent->{name1} = { value inside block }.
<name1 name2> will map to $parent->{name1}->{name2}
name = value will match to name=>value
name = value1 will match to
name = value2name => [ value1, value2 ]