1MooX::ConfigFromFile::RUosleer(3C)ontributed Perl DocumeMnotoaXt:i:oCnonfigFromFile::Role(3)
2
3
4

NAME

6       MooX::ConfigFromFile::Role - Moo eXtension for initializing objects
7       from config file
8

DESCRIPTION

10       This role adds a initializing sub around BUILDARGS and puts all what
11       could read from config files into the hash which will be used to
12       construct the final object.
13
14       While it does that, it internally calls it's own _build_* methods
15       (_build_config_prefix, _build_config_files and _build_loaded_config)
16       unless the appropriate attributes are already in $params.
17

ATTRIBUTES

19       This role uses following attributes which might be suitable customized
20       by overloading the appropriate builder or pass defaults in construction
21       arguments.
22
23       Be sure to read "ATTRIBUTES" in MooX::File::ConfigDir, especially
24       "config_identifier" in MooX::File::ConfigDir to understand how the
25       "config_dirs" are build.
26
27       When you miss a directory - see "plug_dir_source" in File::ConfigDir
28       and File::ConfigDir::Plack.
29
30   config_prefix
31       This attribute is a string and defaults to FindBin's $Script. It's
32       interpreted as the basename of the config file name to use.
33
34   config_prefixes
35       This attribute is an array of strings and defaults to "<[ config_prefix
36       ]">.
37
38   config_prefix_map_separator
39       This attribute is a string and contains the character which is used
40       building config_prefix_map from config_prefixes.
41
42   config_prefix_map
43       This attribute is an array of strings containing all config-prefixes
44       joint together "($0, $0.$1, $0.$1.$2, ...)" using
45       config_prefix_map_separator.
46
47   config_files_pattern
48       This attribute contains a cross-product of config_prefix_map and
49       config_extensions. Both are concatenated using the shell wildcard '*'.
50
51   config_dirs
52       This attribute is consumed from MooX::File::ConfigDir.  It might not be
53       smart to override - but possible. Use with caution.
54
55   config_extensions
56       This attribute defaults to list of extensions from Config::Any.
57
58   config_files
59       This attribute contains the list of existing files in config_dirs
60       matching config_prefix . config_extensions.  Search is operated by
61       File::Find::Rule.
62
63   raw_loaded_config
64       This attribute contains the config as loaded from file system in an
65       array of "filename => \%content".
66
67   sorted_loaded_config
68       This attribute contains the loaded files from filesystem sorted by
69       string in the same format as raw_loaded_config (array of "filename =>
70       \%content").
71
72       The default algorithm is sorted by filename (mind: '-' < '.').
73
74   loaded_config
75       This attribute contains the config loaded and transformed while
76       constructing the instance. Construction is done from
77       sorted_loaded_config, ignoring the filename part.
78
79       For classes set up using
80
81         use MooX::ConfigFromFile config_singleton = 1;
82
83       this attribute is cached from the very first construction and fed by
84       overwritten builder. The content of this attribute is passed to lower
85       BUILDARGS.
86

AUTHOR

88       Jens Rehsack, "<rehsack at cpan.org>"
89

ACKNOWLEDGEMENTS

91       Toby Inkster suggested to rely on BUILDARGS instead of intercepting
92       object creation with nasty hacks. He also taught me a bit more how
93       Moo(se) works.
94
96       Copyright 2013-2018 Jens Rehsack.
97
98       This program is free software; you can redistribute it and/or modify it
99       under the terms of either: the GNU General Public License as published
100       by the Free Software Foundation; or the Artistic License.
101
102       See <http://dev.perl.org/licenses/> for more information.
103
104
105
106perl v5.32.0                      2020-07-28     MooX::ConfigFromFile::Role(3)
Impressum