NAME
Config::JFDI - Just * Do it: A Catalyst::Plugin::ConfigLoader-style layer over Config::Any
VERSION
Version 0.01
SYNPOSIS
use Config::JFDI;
my $config = Config::JFDI->new(name => "my_application", path => "path/to/my/application");
my $config_hash = $config->get;
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::JFDI->new(file => "/path/to/my/application/my_application.cnf");
# To later reload your configuration, fresh from disk:
$config->reload;
DESCRIPTION
Config::JFDI is an implementation of Catalyst::Plugin::ConfigLoader that exists outside of Catalyst.
Essentially, Config::JFDI 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::JFDI 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::JFDI->new).
METHODS
my $config = Config::JFDI->new(...)
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
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
local_suffix The suffix to match when looking for a local configuration. "local" By default
no_env Set this to 1 to disregard anything in the ENV. Off by default
driver A hash consisting of Config:: driver information. This is passed directly through
to Config::Any
Returns a new Config::JFDI object
$config->get
$config->config
$config->load
Load a config as specified by ->new(...) and ENV and return a hash
These will only load the configuration once, so it's safe to call them multiple times without incurring any loading-time penalty
$config->clone
Return a clone of the configuration hash using Clone
This will load the configuration first, if it hasn't already
$config->reload
Reload the configuration, examining ENV and scanning the path anew
Returns a hash of the configuration
SYNOPSIS
AUTHOR
Robert Krimen, <rkrimen at cpan.org>
SEE ALSO
Catalyst::Plugin::ConfigLoader, Config::Any, Catalyst
BUGS
Please report any bugs or feature requests to bug-config-jfdi at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Config-JFDI. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Config::JFDI
You can also look for information at:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2008 Robert Krimen, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.