1Config::MVP::Assembler:U:sWeirthCBounntdrliebsu(t3e)d PeCrolnfDiogc:u:mMeVnPt:a:tAisosnembler::WithBundles(3)
2
3
4
6 Config::MVP::Assembler::WithBundles - a role to make assemblers expand
7 bundles
8
10 version 2.200012
11
13 Config::MVP::Assembler::WithBundles is a role to be composed into a
14 Config::MVP::Assembler subclass. It allows some sections of
15 configuration to be treated as bundles. When any section is ended, if
16 that section represented a bundle, its bundle contents will be unrolled
17 and will replace it in the sequence.
18
19 A package is considered a bundle if "package_bundle_method" returns a
20 defined value (which is the name of a method that will be called on
21 that package to retrieve its bundle config).
22
23 my $method = $assembler->package_bundle_method($package);
24
25 The default implementation looks for a method called
26 "mvp_bundle_config", but "package_bundle_method" can be replaced with
27 one that returns the name of a different bundle-identifying method-
28 name.
29
30 Bundles are expanded by a call to the assembler's
31 "replace_bundle_with_contents" method, like this:
32
33 $assembler->replace_bundle_with_contents($section, $method);
34
35 replace_bundle_with_contents
36 The default "replace_bundle_with_contents" method deletes the section
37 from the sequence. It then gets a description of the new sections to
38 introduce, like this:
39
40 my @new_config = $bundle_section->package->$method({
41 name => $bundle_section->name,
42 package => $bundle_section->package,
43 payload => $bundle_section->payload,
44 });
45
46 (We pass a hashref rather than a section so that bundles can be
47 expanded synthetically without having to laboriously create a new
48 Section.)
49
50 The returned @new_config is a list of arrayrefs, each of which has
51 three entries:
52
53 [ $name, $package, $payload ]
54
55 Each arrayref is converted into a section in the sequence. The
56 $payload should be an arrayref of name/value pairs to be added to the
57 created section.
58
60 Ricardo Signes <rjbs@cpan.org>
61
63 This software is copyright (c) 2021 by Ricardo Signes.
64
65 This is free software; you can redistribute it and/or modify it under
66 the same terms as the Perl 5 programming language system itself.
67
68
69
70perl v5.34.0 2021-07C-o2n2fig::MVP::Assembler::WithBundles(3)