Manual Reference Pages - MOOX::CONFIGFROMFILE::ROLE (3)
MooX::ConfigFromFile::Role - Moo eXtension for initializing objects from config file
This role adds a initializing sub around BUILDARGS
and puts all what could read from config files into the hash which will be
used to construct the final object.
While it does that, it internally calls its own _build_* methods (_build_config_prefix,
_build_config_files and _build_loaded_config) unless the appropriate attributes are
already in $params.
This role uses following attributes which might be suitable customized by
overloading the appropriate builder or pass defaults in construction arguments.
Be sure to read ATTRIBUTES in MooX::File::ConfigDir, especially
config_identifier in MooX::File::ConfigDir to understand how the config_dirs
When you miss a directory - see plug_dir_source in File::ConfigDir and
This attribute is a string and defaults to FindBins $Script. Its
interpreted as the basename of the config file name to use.
This attribute is an array of strings and defaults to <[ config_prefix ]>.
This attribute is a string and contains the character which is used building
config_prefix_map from config_prefixes.
This attribute is an array of strings containing all config-prefixes joint
together ($0, $0.$1, $0.$1.$2, ...) using config_prefix_map_separator.
This attribute contains a cross-product of config_prefix_map and
config_extensions. Both are concatenated using the shell wildcard *.
This attribute is consumed from MooX::File::ConfigDir.
It might not be smart to override - but possible. Use with caution.
This attribute defaults to list of extensions from Config::Any.
This attribute contains the list of existing files in config_dirs matching
config_prefix . config_extensions. Search is operated by File::Find::Rule.
This attribute contains the config as loaded from file system in an array of
filename => \%content. The result from Config::Any is sorted by
filename (- < .).
This attribute contains the config loaded and transformed while constructing
the instance. Construction is done from raw_loaded_config, ignoring the
For classes set up using
use MooX::ConfigFromFile config_singleton = 1;
this attribute is cached from the very first construction and fed by overwritten
builder. The content of this attribute is passed to lower BUILDARGS.
Jens Rehsack, <rehsack at cpan.org>
Toby Inkster suggested to rely on BUILDARGS instead of intercepting object
creation with nasty hacks. He also taught me a bit more how Moo(se) works.
LICENSE AND COPYRIGHT
Copyright 2013-2015 Jens Rehsack.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See <http://dev.perl.org/licenses/> for more information.
|perl v5.20.3 ||MOOX::CONFIGFROMFILE::ROLE (3) ||2015-04-27 |
Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.