Net::XMPP2::Event - Event handler class
package foo; use Net::XMPP2::Event; our @ISA = qw/Net::XMPP2::Event/; package main; my $o = foo->new; $o->reg_cb (foo => sub { ...; 1 }); $o->event (foo => 1, 2, 3);
This module is just a small helper module for the connection and client classes.
You may only derive from this package.
If some event callback threw an exception then $cb is called with the exception as first argument.
$cb
This method registers a callback $cb1 for the event with the name $eventname1. You can also pass multiple of these eventname => callback pairs.
$cb1
$eventname1
The return value will be an ID that represents the set of callbacks you have installed. Call unreg_cb with that ID to remove those callbacks again.
unreg_cb
To see a documentation of emitted events please take a look at the EVENTS section in the classes that inherit from this one.
The callbacks will be called in an array context. If a callback doesn't want to return any value it should return an empty list. All elements of the returned list will be accumulated and the semantic of the accumulated return values depends on the events.
Removes the set $id of registered callbacks. $id is the return value of a reg_cb call.
$id
reg_cb
Emits the event $eventname and passes the arguments @args. The return value is a list of defined return values from the event callbacks.
$eventname
@args
If this method is called from a callback on the first argument to the callback (thats $self) the callback will be deleted after it is finished.
$self
This method allows to forward or copy all events to a object. $forward_cb will be called everytime an event is generated in $self. The first argument to the callback $forward_cb will be <$self>, the second will be $obj, the third will be the event name and the rest will be the event arguments. (For third and rest of argument also see description of event).
$forward_cb
$obj
event
This method removes a forward. $obj must be the same object that was given add_forward as the $obj argument.
add_forward
Robin Redeker, <elmex at ta-sa.org>, JID: <elmex at jabber.org>
<elmex at ta-sa.org>
<elmex at jabber.org>
Copyright 2007 Robin Redeker, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Net::XMPP2, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::XMPP2
CPAN shell
perl -MCPAN -e shell install Net::XMPP2
For more information on module installation, please visit the detailed CPAN module installation guide.