MooX::...eLoaded(3pm)
π MooX::...eLoaded(3pm) β bestie edition π
okay so real talk, the manual name is MooX::...eLoaded(3pm) and it's part of the User Contributed Perl Documentation crew, but the actual module we're simping over is MooX::ConfigFromFile::Role::HashMergeLoaded. buckle up π
β¨ NAME β¨
MooX::ConfigFromFile::Role::HashMergeLoaded β it lets you have better merge strategies for multiple config files π
πΈ SYNOPSIS πΈ
here's the vibe, literally copy-paste this energy:
package MyApp::Cmd::TPau;
use DBI;
use Moo;
use MooX::Cmd with_configfromfile => 1;
with "MooX::ConfigFromFile::Role::HashMergeLoaded";
has csv => (is => "ro", required => 1);
sub execute
{
my $self = shift;
DBI->connect("DBI::csv:", undef, undef, $self->csv);
}
__END__
$ cat etc/myapp.json
{
"csv": {
"f_ext": ".csv/r",
"csv_sep_char": ";",
"csv_class": "Text::CSV_XS"
}
}
$cat etc/myapp-tpau.json
{
"csv": {
"f_dir": "data/tpau"
}
}
notice how etc/myapp.json and etc/myapp-tpau.json both got a csv key? yeah. they're about to get merged, and this role is the one making it not a hot mess π«Ά
π¦ DESCRIPTION π¦
so this is an additional role for MooX::ConfigFromFile, and its whole personality is allowing better merging of deep structures. deep structures, bestie. we're going in π³οΈβ¨
π ATTRIBUTES π
π« config_merge_behavior
this attribute is holding the behavior which config_merger will use to merge particular loaded configurations. it's giving strategy. it's giving β¨choicesβ¨.
π« config_merger
this attribute contains the instance of Hash::Merge that gets used to merge raw_loaded_config into loaded_config. iconic little workhorse π΄π
π« loaded_config
this role modifies the builder for loaded_config by merging the items from raw_loaded_config in order of appearance. the assumption here is that more relevant config files are in front and then they get filled up with defaults in following ones. so: front = main character energy, back = supporting cast π¬π
π AUTHOR π
Jens Rehsack, "<rehsack at cpan.org>" β ty for your service king π«‘π
π ACKNOWLEDGEMENTS π
(no notes, this section is just vibing empty π)
β LICENSE AND COPYRIGHT β
Copyright 2015-2018 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. pick your fighter π
see <http://dev.perl.org/licenses/> for more information. go read it fr fr, no cap π
okay that's the whole page bestie!! this one was shipped as part of perl v5.36.0, dated 2022-12-11, under the name MooX::...eLoaded(3pm). go merge some configs, you're gonna eat π
β¨π¦π
π¦ where this page comes from
- debian bookworm: libmoox-configfromfile-perl 0.009-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoox-configfromfile-perl 0.009-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoox-configfromfile-perl 0.009-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libmoox-configfromfile-perl 0.009-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms