Provided by: libconfig-zomg-perl_1.000000-1.1_all
NAME
Config::ZOMG - Yet Another Catalyst::Plugin::ConfigLoader-style layer over Config::Any
VERSION
version 1.000000
DESCRIPTION
"Config::ZOMG" is a fork of Config::JFDI. It removes a couple of unusual features and passes the same tests three times faster than Config::JFDI. "Config::ZOMG" is an implementation of Catalyst::Plugin::ConfigLoader that exists outside of Catalyst. "Config::ZOMG" will scan a directory for files matching a certain name. If such a file is found which also matches an extension that Config::Any can read, then the configuration from that file will be loaded. "Config::ZOMG" will also look for special files that end with a "_local" suffix. Files with this special suffix will take precedence over any other existing configuration file, if any. The precedence takes place by merging the local configuration with the "standard" configuration via Hash::Merge::Simple. Finally you can override/modify the path search from outside your application, by setting the "${NAME}_CONFIG" variable outside your application (where $NAME is the uppercase version of what you passed to Config::ZOMG->new).
SYNPOSIS
use Config::ZOMG; my $config = Config::ZOMG->new( name => 'my_application', path => 'path/to/my/application', ); my $config_hash = $config->load; This will look for something like (depending on what Config::Any will find): path/to/my/application/my_application_local.{yml,yaml,cnf,conf,jsn,json,...} and path/to/my/application/my_application.{yml,yaml,cnf,conf,jsn,json,...} ... and load the found configuration information appropiately, with "_local" taking precedence. You can also specify a file directly: my $config = Config::ZOMG->new(file => '/path/to/my/application/my_application.cnf'); To later reload your configuration: $config->reload;
METHODS
new $config = Config::ZOMG->new(...) Returns a new "Config::ZOMG" object You can configure the $config object by passing the following to new: name The name specifying the prefix of the configuration file to look for and the ENV variable to read. This can be a package name. In any case, :: will be substituted with _ in "name" and the result will be lowercased. To prevent modification of "name", pass it in as a scalar reference. "path" The directory to search in "file" Directly read the configuration from this file. "Config::Any" must recognize the extension. Setting this will override "path" "no_local" Disable lookup of a local configuration. The "local_suffix" option will be ignored. Off by default "local_suffix" The suffix to match when looking for a local configuration. "local" by default "no_env" Set this to ignore ENV. "env_lookup" will be ignored. Off by default "env_lookup" Additional ENV to check if $ENV{<NAME>...} is not found "driver" A hash consisting of "Config::" driver information. This is passed directly through to "Config::Any" "default" A hash filled with default keys/values open $config_hash = Config::ZOMG->open( ... ) As an alternative way to load a config "open" will pass given arguments to "new" then attempt to do "load" Unlike "load" if no configuration files are found "open" will return "undef" (or the empty list) This is so you can do something like: my $config_hash = Config::ZOMG->open( '/path/to/application.cnf' ) or die "Couldn't find config file!" In scalar context "open" will return the config hash, not the config object. If you want the config object call "open" in list context: my ($config_hash, $config) = Config::ZOMG->open( ... ) You can pass any arguments to "open" that you would to "new" load $config->load Load a config as specified by "new" and "ENV" and return a hash This will only load the configuration once, so it's safe to call multiple times without incurring any loading-time penalty found $config->found Returns a list of files found If the list is empty then no files were loaded/read find $config->find Returns a list of files that configuration will be loaded from. Use this method to check whether configuration files have changed, without actually reloading. clone $config->clone Return a clone of the configuration hash using Clone This will load the configuration first, if it hasn't already reload $config->reload Reload the configuration, examining ENV and scanning the path anew Returns a hash of the configuration
SEE ALSO
Config::JFDI Catalyst::Plugin::ConfigLoader Config::Any Catalyst Config::Merge Config::General
AUTHORS
• Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> • Robert Krimen <robertkrimen@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Arthur Axel "fREW" Schmidt. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.