NAME
MooX::ConfigFromFile::Role - Moo eXtension for initializing objects from config file
DESCRIPTION
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 it's own _build_* methods (_build_config_prefix, _build_config_files and _build_loaded_config) unless the appropriate attributes are already in $params
.
ATTRIBUTES
This role uses following attributes which might be suitable customized by overloading the appropriate builder or pass defaults in construction arguments.
config_prefix
This attribute defaults to FindBin's $Script
. It's interpreted as the basename of the config file name to use.
config_dirs
This attribute is included from MooX::File::ConfigDir. It might be unclever to override - but possible. Use with caution.
config_files
This attribute contains the list of existing files in config_dirs matching config_prefix . Config::Any->extensions. Search is operated by File::Find::Rule.
AUTHOR
Jens Rehsack, <rehsack at cpan.org>
ACKNOWLEDGEMENTS
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-2014 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.