NAME
Net::IPMessenger::EventHandler - IP Messenger event handler base class.
SYNOPSIS
First of all, creates your event handler.
package MyEventHandler;
use base qw (Net::IPMessenger::EventHandler);
sub BR_ENTRY {
my( $self, $ipmsg, $user ) = @_;
...
}
Next, add your event handler in the script.
#!/usr/bin/perl
use Net::IPMessenger;
use MyEventHandler;
my $ipmsg = Net::IPMessenger->new(
...
);
$ipmsg->add_event_handler( new MyEventHandler );
Then you receive a message, your handler method is invoked.
DESCRIPTION
This is a base event handler of Net::IPMessenger.
If you create method which name is same as %Net::IPMessenger::MessageCommand::COMMAND values name, it will be invoked as you receive a message.
METHODS
new
Just creates object.
add_callback
$self->add_callback( $name, \&sub );
Adds callback subroutine &sub and registers name $name.
callback
goto $self->callback($name);
does callback $name.
SEE ALSO
Net::IPMessenger::RecvEventHandler, Net::IPMessenger::ToStdoutEventHandler