Marquee Marquee::Hooks - Hooks manager

TABLE OF CONTENTS

NAME

Marquee::Hooks - Hooks manager

SYNOPSIS

use Marquee::Hooks;

my $hook = Marquee::Hooks->new;

my $out = '';

$hook->on(myhook => sub {
    my ($next, $open, $close) = @_;
    $out .= $open. 'hook1'. $close;
});

$hook->on(myhook => sub {
    my ($next, $open, $close) = @_;
    $next->();
    $out .= $open. 'hook2'. $close;
});

$hook->emit_chain('myhook', '<', '>');

say $out; # $out = '<hook1><hook2>'

DESCRIPTION

Marquee::Hooks is the Hook manager of Marquee.

INSTANCE METHODS

Marquee::Hooks inherits all instance methods from Mojo::EventEmitter and implements the following new ones.

emit_chain

$plugins = $plugins->emit_chain('foo');
$plugins = $plugins->emit_chain(foo => @args);

Emit events as chained hooks.

SEE ALSO

Mojo::EventEmitter, Marquee, Mojolicious