|
NAMEPlagger::Plugin - Base class for Plagger Plugins SYNOPSIS package Plagger::Plugin::Something;
use base qw(Plagger::Plugin);
# register hooks
sub register {
my ($self, $context) = @_;
$context->register_hook( $self,
'thingy.wosit' => $self->can('doodad'),
)
}
sub doodad { ... }
DESCRIPTIONThis is the base class for plagger plugins. Pretty much everything is done by plugins in Plagger. To write a new plugin, simply inherit from Plagger::Plugin: package Plagger::Plugin; use base qw(Plagger::Plugin); Then register some hooks: # register hooks
sub register {
my ($self, $context) = @_;
$context->register_hook( $self,
'thingy.wosit' => $self->can('doodad'),
)
}
This means that the "doodad" method will be called at the "thingy.wosit" stage. There is a handy "plugin-start.pl" in tools tool that creates the template of .pm file, dependency YAML file and test files for you. > ./tools/plugin-start.pl Foo::Bar Methods
AUTHORTatsuhiko Miyagawa <miyagawa@bulknews.net> See AUTHORS file for the name of all the contributors. LICENSEExcept where otherwise noted, Plagger is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO<http://plagger.org/>
|