NAME
Jabber::JAX::Client - Perl wrapper for the Jabber JECL Library creates the Jabber Client Connection Object
SYNOPSIS
use Jabber::JAX::Client;
my $c = new Jabber::JAX::Client(
user => "blah\@blah.org",
passwd => "mysecret",
host => "localhost",
port => "5222",
handler =>
sub {
my ( $rc, $p ) = @_;
my $e = $p->getElement();
my $to = $e->getAttrib('to');
$e->putAttrib('to', $e->getAttrib('from'));
$e->putAttrib('from', $to);
$rc->deliver( $p );
}
);
$c->start();
DESCRIPTION
Jabber::JAX::Client is yet another perl implementation for writing Jabber components. How it differs is that it is a wrapper for the high performance JECL libraries for writing components in C++.
Jabber::JAX::Client is the complement for the jax::RouterConnection C++ object ( see the jax.h header file for a description ). It creates a basic connection object for a client to a jaber server with a thread pool ( currently 10 ), and provides the framework for embedding a perl callback subroutine to handle each incoming packet. See the gen_client.h header file for more details.
To run this you should use perl 5.6.x ( the standard one supplied with RH 7.1 works ) - what ever one you use it MUST NOT be compiled with threads ( no -Dusethread -Duseithreads ) - check perl -V, and you need to get the JECL libraries from http://jabber.tigris.org ( check them out of CVS instead of downloading the tgz files ). The only catch with the libraries are the dependencies ( explained within the library README doco ) - this requires the g++ >= 3.0.x. At the time of writting this can be obtained from http://www.redhat.com in the RH 7.2 beta download section ( yay - GO RedHat ! ).
PROGRAMMING
Further to the SYNOPSIS above - the basic structure for programming with these perl packages is as follows: The Jabber::JAX::Client object takes a subroutine reference for the parameter 'handler'. This subroutine is then called on receipt of every packet by the Jabber client, and passed two arguements ( well three really - but the last - the stringified xml is temporary until the judo::Element object is finalised ). The First argument is $rc - a reference to the RouterConnection ( Jabber::JAX::Client ). It has only two methods that you should use and they are deliver which is passed a Jabber::JAX::Packet object, for delivery, and stop which shutdowns the Client connection. The second argument is $p a reference to the current inbound packet ( Jabber::JAX::Packet ). Use the $p->getElement() method to return a Jabber::Judo::Element object for easy manipulation of the XML packet.
There is currently no way to register a user with this library, so that will have to be achieved with another tool ( client, or library ) prior to running your scripts.
VERSION
very new
AUTHOR
Piers Harding - but DizzyD ( author of JECL ) is the real star
SEE ALSO
Jabber::JAX::Packet, Jabber::JAX::Client, Jabber::JAX::Component, Jabber::Judo::Element