NAME

Dist::Zilla::PluginBundle::Code - a dynamic bundle

VERSION

Version 0.008

SYNOPSIS

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;
}

DESCRIPTION

This bundle implements the Dist::Zilla::Role::PluginBundle role. It can be returned from another bundle by the bundle_config method.

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.

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.

SUPPORT

Bugs / Feature Requests

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.

Source Code

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

AUTHOR

Sven Kirmess <sven.kirmess@kzone.ch>

SEE ALSO

Dist::Zilla, Dist::Zilla::Role::PluginBundle