MooX::...eLoaded(3pm)

πŸ“¦
version 0.009 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– 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 πŸ“)


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