1Config::ZOMG(3) User Contributed Perl Documentation Config::ZOMG(3)
2
3
4
6 Config::ZOMG - Yet Another Catalyst::Plugin::ConfigLoader-style layer
7 over Config::Any
8
10 version 1.000000
11
13 "Config::ZOMG" is a fork of Config::JFDI. It removes a couple of
14 unusual features and passes the same tests three times faster than
15 Config::JFDI.
16
17 "Config::ZOMG" is an implementation of Catalyst::Plugin::ConfigLoader
18 that exists outside of Catalyst.
19
20 "Config::ZOMG" will scan a directory for files matching a certain name.
21 If such a file is found which also matches an extension that
22 Config::Any can read, then the configuration from that file will be
23 loaded.
24
25 "Config::ZOMG" will also look for special files that end with a
26 "_local" suffix. Files with this special suffix will take precedence
27 over any other existing configuration file, if any. The precedence
28 takes place by merging the local configuration with the "standard"
29 configuration via Hash::Merge::Simple.
30
31 Finally you can override/modify the path search from outside your
32 application, by setting the "${NAME}_CONFIG" variable outside your
33 application (where $NAME is the uppercase version of what you passed to
34 Config::ZOMG->new).
35
37 use Config::ZOMG;
38
39 my $config = Config::ZOMG->new(
40 name => 'my_application',
41 path => 'path/to/my/application',
42 );
43 my $config_hash = $config->load;
44
45 This will look for something like (depending on what Config::Any will
46 find):
47
48 path/to/my/application/my_application_local.{yml,yaml,cnf,conf,jsn,json,...}
49
50 and
51
52 path/to/my/application/my_application.{yml,yaml,cnf,conf,jsn,json,...}
53
54 ... and load the found configuration information appropiately, with
55 "_local" taking precedence.
56
57 You can also specify a file directly:
58
59 my $config = Config::ZOMG->new(file => '/path/to/my/application/my_application.cnf');
60
61 To later reload your configuration:
62
63 $config->reload;
64
66 new
67 $config = Config::ZOMG->new(...)
68
69 Returns a new "Config::ZOMG" object
70
71 You can configure the $config object by passing the following to new:
72
73 name
74 The name specifying the prefix of the configuration file to look for
75 and the ENV variable to read. This can be a package name. In any
76 case, :: will be substituted with _ in "name" and the result will be
77 lowercased. To prevent modification of "name", pass it in as a
78 scalar reference.
79
80 "path"
81 The directory to search in
82
83 "file"
84 Directly read the configuration from this file. "Config::Any" must
85 recognize the extension. Setting this will override "path"
86
87 "no_local"
88 Disable lookup of a local configuration. The "local_suffix" option
89 will be ignored. Off by default
90
91 "local_suffix"
92 The suffix to match when looking for a local configuration. "local"
93 by default
94
95 "no_env"
96 Set this to ignore ENV. "env_lookup" will be ignored. Off by default
97
98 "env_lookup"
99 Additional ENV to check if $ENV{<NAME>...} is not found
100
101 "driver"
102 A hash consisting of "Config::" driver information. This is passed
103 directly through to "Config::Any"
104
105 "default"
106 A hash filled with default keys/values
107
108 open
109 $config_hash = Config::ZOMG->open( ... )
110
111 As an alternative way to load a config "open" will pass given arguments
112 to "new" then attempt to do "load"
113
114 Unlike "load" if no configuration files are found "open" will return
115 "undef" (or the empty list)
116
117 This is so you can do something like:
118
119 my $config_hash = Config::ZOMG->open( '/path/to/application.cnf' )
120 or die "Couldn't find config file!"
121
122 In scalar context "open" will return the config hash, not the config
123 object. If you want the config object call "open" in list context:
124
125 my ($config_hash, $config) = Config::ZOMG->open( ... )
126
127 You can pass any arguments to "open" that you would to "new"
128
129 load
130 $config->load
131
132 Load a config as specified by "new" and "ENV" and return a hash
133
134 This will only load the configuration once, so it's safe to call
135 multiple times without incurring any loading-time penalty
136
137 found
138 $config->found
139
140 Returns a list of files found
141
142 If the list is empty then no files were loaded/read
143
144 find
145 $config->find
146
147 Returns a list of files that configuration will be loaded from. Use
148 this method to check whether configuration files have changed, without
149 actually reloading.
150
151 clone
152 $config->clone
153
154 Return a clone of the configuration hash using Clone
155
156 This will load the configuration first, if it hasn't already
157
158 reload
159 $config->reload
160
161 Reload the configuration, examining ENV and scanning the path anew
162
163 Returns a hash of the configuration
164
166 Config::JFDI
167
168 Catalyst::Plugin::ConfigLoader
169
170 Config::Any
171
172 Catalyst
173
174 Config::Merge
175
176 Config::General
177
179 · Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
180
181 · Robert Krimen <robertkrimen@gmail.com>
182
184 This software is copyright (c) 2013 by Arthur Axel "fREW" Schmidt.
185
186 This is free software; you can redistribute it and/or modify it under
187 the same terms as the Perl 5 programming language system itself.
188
189
190
191perl v5.32.0 2020-07-28 Config::ZOMG(3)