Hyungsuk Hong > Hubot-0.1.2 > Hubot::EventEmitter

Download:
Hubot-0.1.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.1.2   Source   Latest Release: Hubot-0.2.7

NAME ^

Hubot::EventEmitter

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.

syntax highlighting: