Tatsuhiko Miyagawa > Plagger > Plagger::Plugin

Download:
Plagger-0.7.17.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View/Report Bugs
Source  

NAME ^

Plagger::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 { ... }

DESCRIPTION ^

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

Methods

new

Standard constructor. Calls init.

init

Initializes the plugin

walk_config_encryption
do_walk
decrypt_config
conf
rule
rule_hook
cache
dispatch_rule_on
class_id
assets_dir
log
cookie_jar

Access the Plagger::Cookies object.

templatize
load_assets

AUTHOR ^

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

See AUTHORS file for the name of all the contributors.

LICENSE ^

Except 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/

syntax highlighting: