.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" 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 "Config::MVP::Assembler::WithBundles 3pm" .TH Config::MVP::Assembler::WithBundles 3pm "2021-01-10" "perl v5.32.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" Config::MVP::Assembler::WithBundles \- a role to make assemblers expand bundles .SH "VERSION" .IX Header "VERSION" version 2.200012 .SH "DESCRIPTION" .IX Header "DESCRIPTION" Config::MVP::Assembler::WithBundles is a role to be composed into a Config::MVP::Assembler subclass. It allows some sections of configuration to be treated as bundles. When any section is ended, if that section represented a bundle, its bundle contents will be unrolled and will replace it in the sequence. .PP A package is considered a bundle if \f(CW\*(C`package_bundle_method\*(C'\fR returns a defined value (which is the name of a method that will be called on that package to retrieve its bundle config). .PP .Vb 1 \& my $method = $assembler\->package_bundle_method($package); .Ve .PP The default implementation looks for a method called \f(CW\*(C`mvp_bundle_config\*(C'\fR, but \&\f(CW\*(C`package_bundle_method\*(C'\fR can be replaced with one that returns the name of a different bundle-identifying method-name. .PP Bundles are expanded by a call to the assembler's \&\f(CW\*(C`replace_bundle_with_contents\*(C'\fR method, like this: .PP .Vb 1 \& $assembler\->replace_bundle_with_contents($section, $method); .Ve .SS "replace_bundle_with_contents" .IX Subsection "replace_bundle_with_contents" The default \f(CW\*(C`replace_bundle_with_contents\*(C'\fR method deletes the section from the sequence. It then gets a description of the new sections to introduce, like this: .PP .Vb 5 \& my @new_config = $bundle_section\->package\->$method({ \& name => $bundle_section\->name, \& package => $bundle_section\->package, \& payload => $bundle_section\->payload, \& }); .Ve .PP (We pass a hashref rather than a section so that bundles can be expanded synthetically without having to laboriously create a new Section.) .PP The returned \f(CW@new_config\fR is a list of arrayrefs, each of which has three entries: .PP .Vb 1 \& [ $name, $package, $payload ] .Ve .PP Each arrayref is converted into a section in the sequence. The \f(CW$payload\fR should be an arrayref of name/value pairs to be added to the created section. .SH "AUTHOR" .IX Header "AUTHOR" Ricardo Signes .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2021 by Ricardo Signes. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.