.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "MooX::ConfigFromFile::Role 3pm" .TH MooX::ConfigFromFile::Role 3pm "2022-12-11" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" MooX::ConfigFromFile::Role \- Moo eXtension for initializing objects from config file .SH "DESCRIPTION" .IX Header "DESCRIPTION" This role adds a initializing sub around \s-1BUILDARGS\s0 and puts all what could read from config files into the hash which will be used to construct the final object. .PP While it does that, it internally calls it's own _build_* methods (\fI_build_config_prefix\fR, \&\fI_build_config_files\fR and \fI_build_loaded_config\fR) unless the appropriate attributes are already in \f(CW$params\fR. .SH "ATTRIBUTES" .IX Header "ATTRIBUTES" This role uses following attributes which might be suitable customized by overloading the appropriate builder or pass defaults in construction arguments. .PP Be sure to read \*(L"\s-1ATTRIBUTES\*(R"\s0 in MooX::File::ConfigDir, especially \&\*(L"config_identifier\*(R" in MooX::File::ConfigDir to understand how the \*(L"config_dirs\*(R" are build. .PP When you miss a directory \- see \*(L"plug_dir_source\*(R" in File::ConfigDir and File::ConfigDir::Plack. .SS "config_prefix" .IX Subsection "config_prefix" This attribute is a string and defaults to FindBin's \f(CW$Script\fR. It's interpreted as the basename of the config file name to use. .SS "config_prefixes" .IX Subsection "config_prefixes" This attribute is an array of strings and defaults to \f(CW\*(C`<[ config_prefix ]\*(C'\fR>. .SS "config_prefix_map_separator" .IX Subsection "config_prefix_map_separator" This attribute is a string and contains the character which is used building \&\fIconfig_prefix_map\fR from \fIconfig_prefixes\fR. .SS "config_prefix_map" .IX Subsection "config_prefix_map" This attribute is an array of strings containing all config-prefixes joint together \f(CW\*(C`($0, $0.$1, $0.$1.$2, ...)\*(C'\fR using \fIconfig_prefix_map_separator\fR. .SS "config_files_pattern" .IX Subsection "config_files_pattern" This attribute contains a cross-product of \fIconfig_prefix_map\fR and \&\fIconfig_extensions\fR. Both are concatenated using the shell wildcard '*'. .SS "config_dirs" .IX Subsection "config_dirs" This attribute is consumed from MooX::File::ConfigDir. It might not be smart to override \- but possible. Use with caution. .SS "config_extensions" .IX Subsection "config_extensions" This attribute defaults to list of extensions from Config::Any. .SS "config_files" .IX Subsection "config_files" This attribute contains the list of existing files in \fIconfig_dirs\fR matching \&\fIconfig_prefix\fR . \fIconfig_extensions\fR. Search is operated by File::Find::Rule. .SS "raw_loaded_config" .IX Subsection "raw_loaded_config" This attribute contains the config as loaded from file system in an array of \&\f(CW\*(C`filename => \e%content\*(C'\fR. .SS "sorted_loaded_config" .IX Subsection "sorted_loaded_config" This attribute contains the loaded files from filesystem sorted by string in the same format as raw_loaded_config (array of \&\f(CW\*(C`filename => \e%content\*(C'\fR). .PP The default algorithm is sorted by filename (\fBmind\fR: \f(CW\*(Aq\-\*(Aq < \*(Aq.\*(Aq\fR). .SS "loaded_config" .IX Subsection "loaded_config" This attribute contains the config loaded and transformed while constructing the instance. Construction is done from \fIsorted_loaded_config\fR, ignoring the filename part. .PP For classes set up using .PP .Vb 1 \& use MooX::ConfigFromFile config_singleton = 1; .Ve .PP this attribute is cached from the very first construction and fed by overwritten \&\fIbuilder\fR. The content of this attribute is passed to lower \fI\s-1BUILDARGS\s0\fR. .SH "AUTHOR" .IX Header "AUTHOR" Jens Rehsack, \f(CW\*(C`\*(C'\fR .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Toby Inkster suggested to rely on \s-1BUILDARGS\s0 instead of intercepting object creation with nasty hacks. He also taught me a bit more how Moo(se) works. .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2013\-2018 Jens Rehsack. .PP This program is free software; you can redistribute it and/or modify it under the terms of either: the \s-1GNU\s0 General Public License as published by the Free Software Foundation; or the Artistic License. .PP See for more information.