The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MooseX::Plaggerize - plagger like plugin feature for Moose

SYNOPSIS

    # in main
    my $c = Your::Context->new;
    $c->load_plugin('HTMLFilter::StickyTime');
    $c->load_plugin({module => 'HTMLFilter::DocRoot', config => { root => '/mobirc/' }});
    $c->run();

    package Your::Context;
    use Moose;
    with 'MooseX::Plaggerize';

    sub run {
        my $self = shift;
        $self->run_hook('response_filter' => $args);
    }

    package Your::Plugin::HTMLFilter::DocRoot;
    use strict;
    use MooseX::Plaggerize::Plugin;

    has root => (
        is       => 'ro',
        isa      => 'Str',
        required => 1,
    );

    hook 'response_filter' => sub {
        my ($self, $context, $args) = @_;
    };

WARNING!! WARNING!!

THIS MODULE IS IN ITS BETA QUALITY. API MAY CHANGE IN THE FUTURE.

DESCRIPTION

MooseX::Plaggerize is Plagger like plugin system for Moose.

MooseX::Plaggerize is a Moose::Role.You can use this module with 'with'.

METHOD

$self->load_plugin({ module => $module, config => $conf)

if you write:

    my $app = MyApp->new;
    $app->load_plugin({ module => 'Foo', config => {hoge => 'fuga'})

above code executes follow code:

    my $app = MyApp->new;
    my $plugin = MyApp::Plugin::Foo->new({hoge => 'fuga'});
    $plugin->register( $app );
$self->register_hook('hook point', $plugin, $code)

register code to hook point.$plugin is instance of plugin.

$self->run_hook('finalize', $c)

run hook.

use case: mostly ;-)

$self->run_hook_first('hook point', @args)

run hook.

if your hook code returns true value, stop the hook loop(this feature likes OK/DECLINED of mod_perl handler).

(please look source code :)

use case: handler like mod_perl

$self->run_hook_filter('hook point', @args)

run hook.

(please look source code :)

use case: html filter

$self->get_hook('hook point')

get the codes.

use case: write tricky code :-(

TODO

no plan :-)

AUTHOR

Tokuhiro Matsuno <tokuhirom@gmail.com>

SEE ALSO

Moose, Class::Component, Plagger

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.