Config-MVP-2.200008

NAME

Config::MVP::Assembler::WithBundles - a role to make assemblers expand bundles

VERSION

version 2.200008

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.

A package is considered a bundle if package_bundle_method returns a defined value (which is the name of a method that will be called on that package to retrieve its bundle config).

my $method = $assembler->package_bundle_method($package);

The default implementation looks for a method called mvp_bundle_config, but package_bundle_method can be replaced with one that returns the name of a different bundle-identifying method-name.

Bundles are expanded by a call to the assembler's replace_bundle_with_contents method, like this:

$assembler->replace_bundle_with_contents($section, $method);

replace_bundle_with_contents

The default replace_bundle_with_contents method deletes the section from the sequence. It then gets a description of the new sections to introduce, like this: