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.200013
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 This module should work on any version of perl still receiving updates
61 from the Perl 5 Porters. This means it should work on any version of
62 perl released in the last two to three years. (That is, if the most
63 recently released version is v5.40, then this module should work on
64 both v5.40 and v5.38.)
65
66 Although it may work on older versions of perl, no guarantee is made
67 that the minimum required version will not be increased. The version
68 may be increased for any reason, and there is no promise that patches
69 will be accepted to lower the minimum required perl.
70
72 Ricardo Signes <cpan@semiotic.systems>
73
75 This software is copyright (c) 2022 by Ricardo Signes.
76
77 This is free software; you can redistribute it and/or modify it under
78 the same terms as the Perl 5 programming language system itself.
79
80
81
82perl v5.36.0 2023-01C-o2n0fig::MVP::Assembler::WithBundles(3)