File: README

package info (click to toggle)
libconfig-zomg-perl 1.000000-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 264 kB
  • sloc: perl: 352; makefile: 9; sh: 4
file content (182 lines) | stat: -rw-r--r-- 5,277 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
NAME
    Config::ZOMG - Yet Another Catalyst::Plugin::ConfigLoader-style layer
    over Config::Any

VERSION
    version 1.000000

DESCRIPTION
    "Config::ZOMG" is a fork of Config::JFDI. It removes a couple of unusual
    features and passes the same tests three times faster than Config::JFDI.

    "Config::ZOMG" is an implementation of Catalyst::Plugin::ConfigLoader
    that exists outside of Catalyst.

    "Config::ZOMG" 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::ZOMG" 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::ZOMG->new).

SYNPOSIS
     use Config::ZOMG;

     my $config = Config::ZOMG->new(
       name => 'my_application',
       path => 'path/to/my/application',
     );
     my $config_hash = $config->load;

    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::ZOMG->new(file => '/path/to/my/application/my_application.cnf');

    To later reload your configuration:

     $config->reload;

METHODS
  new
     $config = Config::ZOMG->new(...)

    Returns a new "Config::ZOMG" object

    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 override "path"

    "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

    "no_env"
      Set this to ignore ENV. "env_lookup" 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"

    "default"
      A hash filled with default keys/values

  open
     $config_hash = Config::ZOMG->open( ... )

    As an alternative way to load a config "open" will pass given arguments
    to "new" then attempt to do "load"

    Unlike "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::ZOMG->open( '/path/to/application.cnf' )
       or die "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::ZOMG->open( ... )

    You can pass any arguments to "open" that you would to "new"

  load
     $config->load

    Load a config as specified by "new" and "ENV" and return a hash

    This will only load the configuration once, so it's safe to call
    multiple times without incurring any loading-time penalty

  found
     $config->found

    Returns a list of files found

    If the list is empty then no files were loaded/read

  find
      $config->find

    Returns a list of files that configuration will be loaded from. Use this
    method to check whether configuration files have changed, without
    actually reloading.

  clone
     $config->clone

    Return a clone of the configuration hash using Clone

    This will load the configuration first, if it hasn't already

  reload
     $config->reload

    Reload the configuration, examining ENV and scanning the path anew

    Returns a hash of the configuration

SEE ALSO
    Config::JFDI

    Catalyst::Plugin::ConfigLoader

    Config::Any

    Catalyst

    Config::Merge

    Config::General

AUTHORS
    *   Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>

    *   Robert Krimen <robertkrimen@gmail.com>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2013 by Arthur Axel "fREW" Schmidt.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.