NAME

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

VERSION

version 0.092990

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 the this returns a defined method:

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

The default implementation looks for a method callde mvp_bundle_config, but package_bundle_method can be replaced to allow for other bundle-identifying information.

Bundles are expanded by having their bundle method called like this:

my @new_config = $bundle_section->package->$method({
  name    => $bundle_section->name,
  package => $bundle_section->package,
  payload => $bundle_section->payload,
});

(We pass a hashref rather than a section so that bundles can be expanded synthetically without having to laboriously create a new Section.)

The returned @new_config is a list of arrayrefs, each of which has three entries:

[ $name, $package, $payload ]

Each arrayref is converted into a section in the sequence.

AUTHOR

Ricardo Signes <rjbs@cpan.org>

COPYRIGHT AND LICENSE

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 the Perl 5 programming language system itself.