Daniel Friesel > App-Slackeria > App::Slackeria::Plugin

Download:
App-Slackeria-0.12.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.12   Source  

NAME ^

App::Slackeria::Plugin - parent class for all slackeria plugins

SYNOPSIS ^

    use parent 'App::Slackeria::Plugin';

    sub check {
        my ($self) = @_;

        if (everything_ok()) {
            return {
                data => show_things(),
            };
        }
        else {
            die("not found\n");
        }
    }

VERSION ^

version 0.12

DESCRIPTION ^

App::Slackeria::Plugin is not a plugin itself; it is meant to serve as a parent class for all other plugins.

METHODS ^

$plugin = App::Slackeria::Plugin::Something->new(%conf);

Returns a new object. A reference to %conf is stored in $self->{default}.

$plugin->run($conf)

Merges $self->{default} and $conf and saves the result in $self->{conf}. $conf takes precedence; $self->{default} and $conf are not touched in the process.

If $conf{enable} is set to 0, immediately returns { skip => 1 }.

It then calls the check function of App::Slackeria::Plugin::Something. If it fails (dies or returns undef), { ok => 0, data => $@} is returned.

The hashref returned by the check call is returned, with the additional key ok set to 1. Also, if $conf{href} is set, but check did not set a href key, href is set to $conf{href} with %s replaced by $conf{name}.

DEPENDENCIES ^

None.

SEE ALSO ^

slackeria(1), App::Slackeria::PluginLoader(3pm).

AUTHOR ^

Copyright (C) 2011 by Daniel Friesel <derf@finalrewind.org>

LICENSE ^

  0. You just DO WHAT THE FUCK YOU WANT TO.
syntax highlighting: