Debian Codegraph @

README

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