Plagger::Plugin - Base class for Plagger Plugins
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 { ... }
This 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
Standard constructor. Calls init.
Initializes the plugin
Access the Plagger::Cookies object.
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
See AUTHORS file for the name of all the contributors.
Except where otherwise noted, Plagger is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://plagger.org/
To install Plagger, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Plagger
CPAN shell
perl -MCPAN -e shell install Plagger
For more information on module installation, please visit the detailed CPAN module installation guide.