Config:...sembler(3)
π Config:...sembler(3) π
okay so bestie, you found the manual page for Config::MVP::Assembler β it's filed under User Contributed Perl Documentation, and honestly? she's a whole vibe. let's get into it π
β¨ NAME β¨
Config::MVP::Assembler β the multivalue-property config-loading state machine. yes, that's the whole job description. she loads configs and she keeps state. queen behavior. π
πΈ VERSION πΈ
version 2.200013
π¦ DESCRIPTION π¦
okay first things first β you should probably go read the example of using Config::MVP first. if you already know how it works, keep going, no worries. π
Config::MVP::Assembler is a helper for constructing a Config::MVP::Sequence object. she's a very simple state machine that lets you signal what kind of events you've encountered while reading configuration. that's it, that's the gig. and she ate. β¨
π PERL VERSION π
This module should work on any version of perl still receiving updates from the Perl 5 Porters. This means it should work on any version of perl released in the last two to three years. (That is, if the most recently released version is v5.40, then this module should work on both v5.40 and v5.38.)
Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl.
ngl that last part is giving "we love you but we're not promising anything" π no cap, read it before you pin your hopes on ancient perl.
π ATTRIBUTES π
π sequence_class
This attribute stores the name of the class to be used for the assembler's sequence. It defaults to Config::MVP::Sequence.
π section_class
This attribute stores the name of the class to be used for sections created by the assembler. It defaults to Config::MVP::Section.
π sequence
This is the sequence that the assembler is assembling. It defaults to a new instance of the assembler's sequence_class.
β METHODS β
π§ begin_section
$assembler->begin_section($package_moniker, $name);
$assembler->begin_section($package_moniker);
$assembler->begin_section( \$package );
This method tells the assembler that it should begin work on a new section with the given identifier. If it is already working on a section, an error will be raised. See change_section for a method to begin a new section, ending the current one if needed.
The package moniker is expanded by the expand_package method. The name, if not given, defaults to the package moniker. These data are used to create a new section and the section is added to the end of the sequence. If the package argument is a reference, it is used as the literal value for the package, and no expansion is performed. If it is a reference to undef, a section with no package is created.
π§ end_section
$assembler->end_section;
This ends the current section. If there is no current section, an exception is raised.
so like, don't end a section that was never begun. she WILL raise an exception at you. π
π§ change_section
$assembler->change_section($package_moniker, $name);
$assembler->change_section($package_moniker);
This method calls begin_section, first calling end_section if needed.
π§ add_value
$assembler->add_value( $name => $value );
This method tells the assembler that it has encountered a named value and should add it to the current section. If there is no current section, an exception is raised. (If this is not the first time we've seen the name in the section and it's not a multivalue property, the section class will raise an exception on its own.)
not her raising the exception, the section class raising it. she's just the messenger, bestie π
π§ expand_package
This method is passed a short identifier for a package and is expected to return the full name of the module to load and package to interrogate. By default it simply returns the name it was passed, meaning that package names must be given whole to the change_section method.
π§ current_section
This returns the section object onto which the assembler is currently adding values. If no section has yet been created, this method will return false.
π TYPICAL USE π
okay here's the moment, the main character montage β¨
my $assembler = Config::MVP::Assembler->new;
# Maybe you want a starting section:
my $starting_section = $assembler->section_class->new({ name => '_' });
$assembler->sequence->add_section($section_starting);
# We'll add some values, which will go to the starting section:
$assembler->add_value(x => 10);
$assembler->add_value(y => 20);
# Change to a new section...
$assembler->change_section($moniker);
# ...and add values to that section.
$assembler->add_value(x => 100);
$assembler->add_value(y => 200);
The code above creates an assembler and populates it step by step. In the end, to get values, you could do something like this:
my @output;
for my $section ($assembler->sequence->sections) {
push @output, [ $section->name, $section->package, $section->payload ];
}
When changing sections, the given section "moniker" is used for the new section name. The result of passing that moniker to the assembler's expand_package method is used as the section's package name. (By default, this method does nothing.) The new section's multivalue_args and aliases are determined by calling the mvp_multivalue_args and mvp_aliases methods on the package.
π AUTHOR π
Ricardo Signes <cpan@semiotic.systems>
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2022 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
and that's the whole page, bestie π«Ά this was perl v5.42.0, dated 2025-07-25, brought to you as Config:...sembler(3) in User Contributed Perl Documentation. slay, read the docs, hydrate, and go build a sequence. periodt π
πΈ
π¦ where this page comes from
- fedora 43: perl-Config-MVP 2.200013-9.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-Config-MVP 2.200013-9.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms