Config::JFDI(3)
β¨ Config::JFDI β¨
okay so bestie, welcome to the Config::JFDI manual page β that's a User Contributed Perl Documentation page, and it's giving version 0.065, no cap. π
π NAME π
Config::JFDI β Just * Do it: a Catalyst::Plugin::ConfigLoader-style layer sitting pretty on top of Config::Any. π¦
β VERSION β
version 0.065 π
πΈ DESCRIPTION πΈ
So like, Config::JFDI is basically an implementation of Catalyst::Plugin::ConfigLoader that exists outside of Catalyst. It's the same energy, just free-range. π§
Essentially, Config::JFDI will scan a directory for files matching a certain name. If it finds such a file, and that file also matches an extension that Config::Any can read, then the configuration from that file gets loaded. Simple. Iconic. β¨
Config::JFDI will also look for special files that end with a _local suffix. Files with this special suffix take precedence over any other existing configuration file, if any. That precedence happens by merging the local configuration with the "standard" configuration via Hash::Merge::Simple. π
And 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 whatever you passed to Config::JFDI->new. π
π SYNPOSIS π
okay here's the vibe:
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, if that's more your main character moment:
my $config = Config::JFDI->new(file => "/path/to/my/application/my_application.cnf");
And to later reload your configuration, fresh from disk:
$config->reload;
π¦ Config::Loader π¦
We are currently kicking around ideas for a next-generation configuration loader. The goals are:
* A universal platform for configuration slurping and post-processing
* Use Config::Any to do configuration loading
* A sane API so that developers can roll their own loader according to the needs of their application
* A friendly interface so that users can have it just DWIM
* Host/application/instance specific configuration via _local and %ENV
Find more information and contribute at:
- Roadmap:
<http://sites.google.com/site/configloader/> - Mailing list:
<http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/config-loader>
π Behavior change of the 'file' parameter in 0.06 π
okay so in previous versions, Config::JFDI would treat the file parameter as a path parameter, stripping off the extension (ignoring it) and globbing what remained against all the extensions that Config::Any could provide. Like, it would do this:
Config::JFDI->new( file => 'xyzzy.cnf' );
# Transform 'xyzzy.cnf' into 'xyzzy.pl', 'xyzzy.yaml', 'xyzzy_local.pl', ... (depending on what Config::Any could parse)
This is probably not what people intended. π Config::JFDI will now squeak a warning if you pass file through, but you can suppress the warning with no_06_warning or quiet_deprecation:
Config::JFDI->new( file => 'xyzzy.cnf', no_06_warning => 1 );
Config::JFDI->new( file => 'xyzzy.cnf', quiet_deprecation => 1 ); # More general
If you do want the original behavior, simply pass in the file parameter as the path parameter instead:
Config::JFDI->new( path => 'xyzzy.cnf' ); # Will work as before
π METHODS π
β¨ $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. 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 overridepath.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 ("config_local_suffix"will also work so as to be drop-in compatible with C::P::CL).no_envβ Set this to1to disregard anything in the ENV. The'env_lookup'option 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.install_accessorβ Set this to1to install a Catalyst-style accessor as<name>::config. You can also specify the package name directly by settinginstall_accessorto it (e.g.install_accessor => "My::Application").substituteβ A hash consisting of subroutines called during the substitution phase of configuration preparation. ("substitutions"will also work so as to be drop-in compatible with C::P::CL.) A substitution subroutine has the following signature:($config, [ $argument1, $argument2, ... ]).path_toβ The path to dir to use for the__path_to(...)__substitution. If nothing is given, then the'home'config value will be used ($config->get->{home}). Failing that, the current directory will be used.defaultβ A hash filled with default keys/values.
Returns a new Config::JFDI object. π
π $config_hash = Config::JFDI->open( ... ) π
As an alternative way to load a config, ->open will pass given arguments to ->new( ... ), then attempt to do ->load.
Unlike ->get or ->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::JFDI->open( "/path/to/application.cnf" ) or croak "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::JFDI->open( ... )
You can pass any arguments to ->open that you would to ->new. π
π $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. Slay. β¨
π $config->found π
Returns a list of files found.
If the list is empty, then no files were loaded/read. π
πΈ $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.
π $config->substitute( <value>, <value>, ... ) π
For each given <value>, if <value> looks like a substitution specification, then run the substitution macro on <value> and store the result.
There are three default substitutions (the same as Catalyst::Plugin::ConfigLoader):
"__HOME__"β replaced with"$c->path_to('')""__path_to(foo/bar)__"β replaced with"$c->path_to('foo/bar')""__literal(__FOO__)__"β leaves__FOO__alone (allows you to use"__DATA__"as a config value, for example)
The parameter list is split on comma (",").
You can define your own substitutions by supplying the substitute option to ->new. π«Ά
π SEE ALSO π
- Catalyst::Plugin::ConfigLoader
- Config::Any
- Catalyst
- Config::Merge
- Config::General
π AUTHOR π
Robert Krimen <robertkrimen@gmail.com>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2011 by Robert Krimen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay that's the whole page bestie, tysm for reading, mwah π this was Config::JFDI(3) as shipped with perl v5.42.0, dated 2025-07-25 β go forth and configure, you absolute icon πβ¨
π¦ where this page comes from
- fedora 43: perl-Config-JFDI 0.065-41.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms