Marquee Marquee::Plugin - Plugin base class

TABLE OF CONTENTS

NAME

Marquee::Plugin - Plugin base class

SYNOPSIS

package Marquee::Plugin::SomePlugin;
use Mojo::Base 'Marquee::Plugin';

sub register {
    my ($self, $app, @args) = @_;
    ...
    return $self;
}

DESCRIPTION

Marquee::Plugin is the plugin base class of Marquee plugins.

Marquee provides some hook points to extend the behavior of applications. With the hooks, you can develop reusable plugins under Marquee::Plugin::* namespace.

A plugin looks like as follows.

package Marquee::Plugin::SomePlugin;
use Mojo::Base 'Marquee::Plugin';

sub register {
    my ($self, $app, $params) = @_;
    
    $app->hook(around_dispatch => sub {
        my ($next) = @_;
        
        my $c = Marquee->c;
        
        if (! $c->served) {
            $next->();
        }
    });
}

There is some hook points available. See "hook" in Marquee.

CLASS METHODS

Marquee::Plugin implements the following class methods.

register

This must be overridden by sub classes.

sub register {
    my ($self, $app, @conf) = @_;
    ...
    return;
}

The method should be available as follows

$plugin->register($app, ...);

SEE ALSO

Marquee, Mojolicious