NAME

Hubot::EventEmitter

VERSION

version 0.2.8

SYNOPSIS

package Foo;
use Moose;
extends 'Hubot::EventEmitter';

package main;
my $foo = Foo->new;
$foo->on(
    'event1',
    sub {
        my ($e, @args) = @_;    # $e is event emitter. ignore.
        print "@args\n";    # 1 2 3 4
    }
);

$foo->emit('event1', 1, 2, 3, 4);

DESCRIPTION

subscribe event via on then execute callback via emit.

METHODS

on

args - event-name, callback

emit

args - event-name, @arg-pass-to-callback

AUTHOR

Hyungsuk Hong <hshong@perl.kr>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Hyungsuk Hong.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.