You provide it with the path to the directory which contains all of your config files and sub-directories, and it will recurse through the tree, loading and merging the files for you.
This is done only once at application startup, and is easily accessible to the rest of your application:
our $C = Config::Loader->new('/path/to/config')
which you use in any module that requires access. In this case, it exports the single function C() which gives you access to the config singleton:use Config::Loader ('My::Config' => '/path/to/config');
use My::Config; $config = C(); $db = $config->{global}{hosts}{db}{2}; or $db = C('global.hosts.db.2');
Config::Loader will handle files containing XML, YAML, JSON, Config::General, INI or Perl. Also, it has a defined merge policy that allows you to overwrite the production configuration locally (eg for development). If you don't like the merge policy, it provides you with hooks to alter it.
Clint
In reply to Re: Application-wide configuration
by clinton
in thread Application-wide configuration
by akho
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |