| MooseX-Plaggerize documentation | view source | Contained in the MooseX-Plaggerize distribution. |
MooseX::Plaggerize - plagger like plugin feature for Moose
# 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) = @_;
};
THIS MODULE IS IN ITS BETA QUALITY. API MAY CHANGE IN THE FUTURE.
MooseX::Plaggerize is Plagger like plugin system for Moose.
MooseX::Plaggerize is a Moose::Role.You can use this module with 'with'.
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 );
register code to hook point.$plugin is instance of plugin.
run hook.
use case: mostly ;-)
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
run hook.
(please look source code :)
use case: html filter
get the codes.
use case: write tricky code :-(
no plan :-)
Tokuhiro Matsuno <tokuhirom@gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| MooseX-Plaggerize documentation | view source | Contained in the MooseX-Plaggerize distribution. |