Config::MVP::Assembler - multivalue-property config-loading state machine
version 0.092060
Config::MVP::Assembler is a helper for constructing a Config::MVP::Sequence object.
my $assembler = Config::MVP::Assembler->new; # Maybe you want a starting section: my $section = $assembler->section_class->new({ name => '_' }); $assembler->sequence->add_section($section); # 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.
"expand_package"
multivalue_args
aliases
mvp_multivalue_args
mvp_aliases
Ricardo Signes <rjbs@cpan.org>
This software is copyright (c) 2009 by Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as perl itself.
To install Config::MVP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::MVP
CPAN shell
perl -MCPAN -e shell install Config::MVP
For more information on module installation, please visit the detailed CPAN module installation guide.