Dist::Zilla::PluginBundle::Code - a dynamic bundle
Version 0.008
package Dist::Zilla::PluginBundle::MyBundle; use Moose; with 'Dist::Zilla::Role::PluginBundle'; sub bundle_config { my ( $class, $section ) = @_; my @plugins; push @plugins, [ 'SomeUniqueName', 'Dist::Zilla::PluginBundle::Code', { bundle_config => sub { my ($self) = @_; print $self->payload->{some_arg}, "\n"; # Dist::Zilla expects you to return plugins and bundles # or nothing. return; }, some_arg => 'some value', another_arg => 'another value', }, ]; return @plugins; }
This bundle implements the Dist::Zilla::Role::PluginBundle role. It can be returned from another bundle by the bundle_config method.
bundle_config
Dist::Zilla will then run the bundle_config method of this code bundle. This is mainly useful if your bundle wants to return a plugin that runs in the initialization phase (e.g. Dist::Zilla::Plugin::lib) and run a function after that plugin run.
This, being a bundle, has no access to the zilla object nor the various log methods. But you can access the name and payload attributes. The payload attribute is a hash ref that contains the arguments given to the code bundle.
zilla
log
name
payload
Note: Bundles that consume the Dist::Zilla::Role::PluginBundle::Easy role immediately resolve other bundles themselves, there is no way to push a bundle back onto the stack. Therefore it doesn't make sense to use this code bundle inside Dist::Zilla::Role::PluginBundle::Easy bundles.
Please report any bugs or feature requests through the issue tracker at https://github.com/skirmess/Dist-Zilla-Plugin-Code/issues. You will be notified automatically of any progress on your issue.
This is open source software. The code repository is available for public review and contribution under the terms of the license.
https://github.com/skirmess/Dist-Zilla-Plugin-Code
git clone https://github.com/skirmess/Dist-Zilla-Plugin-Code.git
Sven Kirmess <sven.kirmess@kzone.ch>
Dist::Zilla, Dist::Zilla::Role::PluginBundle
To install Dist::Zilla::Plugin::Code, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Plugin::Code
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Plugin::Code
For more information on module installation, please visit the detailed CPAN module installation guide.