.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Config::ZOMG 3pm" .TH Config::ZOMG 3pm "2021-01-07" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Config::ZOMG \- Yet Another Catalyst::Plugin::ConfigLoader\-style layer over Config::Any .SH "VERSION" .IX Header "VERSION" version 1.000000 .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\f(CW\*(C`Config::ZOMG\*(C'\fR is a fork of Config::JFDI. It removes a couple of unusual features and passes the same tests three times faster than Config::JFDI. .PP \&\f(CW\*(C`Config::ZOMG\*(C'\fR is an implementation of Catalyst::Plugin::ConfigLoader that exists outside of Catalyst. .PP \&\f(CW\*(C`Config::ZOMG\*(C'\fR 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. .PP \&\f(CW\*(C`Config::ZOMG\*(C'\fR will also look for special files that end with a \f(CW\*(C`_local\*(C'\fR 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 \*(L"standard\*(R" configuration via Hash::Merge::Simple. .PP Finally you can override/modify the path search from outside your application, by setting the \f(CW\*(C`${NAME}_CONFIG\*(C'\fR variable outside your application (where \&\f(CW$NAME\fR is the uppercase version of what you passed to Config::ZOMG\->new). .SH "SYNPOSIS" .IX Header "SYNPOSIS" .Vb 1 \& use Config::ZOMG; \& \& my $config = Config::ZOMG\->new( \& name => \*(Aqmy_application\*(Aq, \& path => \*(Aqpath/to/my/application\*(Aq, \& ); \& my $config_hash = $config\->load; .Ve .PP This will look for something like (depending on what Config::Any will find): .PP .Vb 1 \& path/to/my/application/my_application_local.{yml,yaml,cnf,conf,jsn,json,...} .Ve .PP and .PP .Vb 1 \& path/to/my/application/my_application.{yml,yaml,cnf,conf,jsn,json,...} .Ve .PP \&... and load the found configuration information appropiately, with \f(CW\*(C`_local\*(C'\fR taking precedence. .PP You can also specify a file directly: .PP .Vb 1 \& my $config = Config::ZOMG\->new(file => \*(Aq/path/to/my/application/my_application.cnf\*(Aq); .Ve .PP To later reload your configuration: .PP .Vb 1 \& $config\->reload; .Ve .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" .Vb 1 \& $config = Config::ZOMG\->new(...) .Ve .PP Returns a new \f(CW\*(C`Config::ZOMG\*(C'\fR object .PP You can configure the \f(CW$config\fR object by passing the following to new: .IP "name" 2 .IX Item "name" The name specifying the prefix of the configuration file to look for and the \s-1ENV\s0 variable to read. This can be a package name. In any case, :: will be substituted with _ in \f(CW\*(C`name\*(C'\fR and the result will be lowercased. To prevent modification of \f(CW\*(C`name\*(C'\fR, pass it in as a scalar reference. .ie n .IP """path""" 2 .el .IP "\f(CWpath\fR" 2 .IX Item "path" The directory to search in .ie n .IP """file""" 2 .el .IP "\f(CWfile\fR" 2 .IX Item "file" Directly read the configuration from this file. \f(CW\*(C`Config::Any\*(C'\fR must recognize the extension. Setting this will override \f(CW\*(C`path\*(C'\fR .ie n .IP """no_local""" 2 .el .IP "\f(CWno_local\fR" 2 .IX Item "no_local" Disable lookup of a local configuration. The \f(CW\*(C`local_suffix\*(C'\fR option will be ignored. Off by default .ie n .IP """local_suffix""" 2 .el .IP "\f(CWlocal_suffix\fR" 2 .IX Item "local_suffix" The suffix to match when looking for a local configuration. \f(CW\*(C`local\*(C'\fR by default .ie n .IP """no_env""" 2 .el .IP "\f(CWno_env\fR" 2 .IX Item "no_env" Set this to ignore \s-1ENV.\s0 \f(CW\*(C`env_lookup\*(C'\fR will be ignored. Off by default .ie n .IP """env_lookup""" 2 .el .IP "\f(CWenv_lookup\fR" 2 .IX Item "env_lookup" Additional \s-1ENV\s0 to check if \f(CW$ENV{...}\fR is not found .ie n .IP """driver""" 2 .el .IP "\f(CWdriver\fR" 2 .IX Item "driver" A hash consisting of \f(CW\*(C`Config::\*(C'\fR driver information. This is passed directly through to \f(CW\*(C`Config::Any\*(C'\fR .ie n .IP """default""" 2 .el .IP "\f(CWdefault\fR" 2 .IX Item "default" A hash filled with default keys/values .SS "open" .IX Subsection "open" .Vb 1 \& $config_hash = Config::ZOMG\->open( ... ) .Ve .PP As an alternative way to load a config \f(CW\*(C`open\*(C'\fR will pass given arguments to \&\*(L"new\*(R" then attempt to do \*(L"load\*(R" .PP Unlike \*(L"load\*(R" if no configuration files are found \f(CW\*(C`open\*(C'\fR will return \&\f(CW\*(C`undef\*(C'\fR (or the empty list) .PP This is so you can do something like: .PP .Vb 2 \& my $config_hash = Config::ZOMG\->open( \*(Aq/path/to/application.cnf\*(Aq ) \& or die "Couldn\*(Aqt find config file!" .Ve .PP In scalar context \f(CW\*(C`open\*(C'\fR will return the config hash, \fBnot\fR the config object. If you want the config object call \f(CW\*(C`open\*(C'\fR in list context: .PP .Vb 1 \& my ($config_hash, $config) = Config::ZOMG\->open( ... ) .Ve .PP You can pass any arguments to \f(CW\*(C`open\*(C'\fR that you would to \*(L"new\*(R" .SS "load" .IX Subsection "load" .Vb 1 \& $config\->load .Ve .PP Load a config as specified by \*(L"new\*(R" and \f(CW\*(C`ENV\*(C'\fR and return a hash .PP This will only load the configuration once, so it's safe to call multiple times without incurring any loading-time penalty .SS "found" .IX Subsection "found" .Vb 1 \& $config\->found .Ve .PP Returns a list of files found .PP If the list is empty then no files were loaded/read .SS "find" .IX Subsection "find" .Vb 1 \& $config\->find .Ve .PP Returns a list of files that configuration will be loaded from. Use this method to check whether configuration files have changed, without actually reloading. .SS "clone" .IX Subsection "clone" .Vb 1 \& $config\->clone .Ve .PP Return a clone of the configuration hash using Clone .PP This will load the configuration first, if it hasn't already .SS "reload" .IX Subsection "reload" .Vb 1 \& $config\->reload .Ve .PP Reload the configuration, examining \s-1ENV\s0 and scanning the path anew .PP Returns a hash of the configuration .SH "SEE ALSO" .IX Header "SEE ALSO" Config::JFDI .PP Catalyst::Plugin::ConfigLoader .PP Config::Any .PP Catalyst .PP Config::Merge .PP Config::General .SH "AUTHORS" .IX Header "AUTHORS" .IP "\(bu" 4 Arthur Axel \*(L"fREW\*(R" Schmidt .IP "\(bu" 4 Robert Krimen .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2013 by Arthur Axel \*(L"fREW\*(R" Schmidt. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.