MozRepl::Plugin::Base - Plugin base class.


MozRepl documentation  | view source Contained in the MozRepl distribution.

Index


NAME

Top

MozRepl::Plugin::Base - Plugin base class.

VERSION

Top

version 0.03

SYNOPSIS

Top

    package MozRepl::Plugin::Foo::Bar;

    use strict;
    use warnings;

    use base qw(MozRepl::Plugin::Base);

    sub execute {
        my ($self, $ctx, $args) = @_;

        $ctx->execute(q|window.alert("Anta ga taisho!")|);
    }

    1;

    package main;

    use MozRepl;

    my $repl = MozRepl->new;
    $repl->setup({ plugins => { plugins => [qw/Foo::Bar/] } });
    $repl->foo_bar();

DESCRIPTION

Top

This module is base class any plugins for MozRepl.

METHODS

Top

new($args)

Create instance.

$args

Hash reference.

setup($ctx, @args)

Called from MozRepl setup() method. This is abstract method, If you want to task in setup pharse, then must be overriding this method.

$ctx

Context object. See MozRepl

@args

Extra parameters.

execute($ctx, @args)

Execute plugin method. Please override me.

$ctx

Context object. See MozRepl

@args

Extra parameters.

method_name()

If you override this method and return constant string, then the string will be used as method name in context.

Not overriding method name will be determined by MozRepl::Util plugin_to_method() method. See plugin_to_method($plugin, $search) in MozRepl::Util

process($name, $vars)

Processing template using by Template, Template::Provider::FromDATA.

$name

Label name in DATA Section.

$vars

Append values as hash reference.

SEE ALSO

Top

MozRepl
Template
Template::Provider::FromDATA

AUTHOR

Top

Toru Yamaguchi, <zigorou@cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-mozrepl-plugin-base@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Top


MozRepl documentation  | view source Contained in the MozRepl distribution.