Hubot::EventEmitter
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);
subscribe event via on then execute callback via emit.
on
emit
args - event-name, callback
event-name
callback
args - event-name, @arg-pass-to-callback
@arg-pass-to-callback
Hyungsuk Hong <hshong@perl.kr>
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.
To install Hubot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hubot
CPAN shell
perl -MCPAN -e shell install Hubot
For more information on module installation, please visit the detailed CPAN module installation guide.