NAME

Jabber::JAX::Component - Perl wrapper for the Jabber JECL Library creates the Jabber Compoent Connection Object

SYNOPSIS

 use Jabber::JAX::Component;

 my $c = new Jabber::JAX::Component(
       component   => "echocomp",
       secret      => "mysecret",
       host        => "localhost",
       port        => "7000",
       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::Component 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::Component 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 component 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_component.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::Component object takes a subroutine reference for the parameter 'handler'. This subroutine is then called on receipt of every packet by the Jabber component, 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::Component ). It has only two methods that you should use and that is deliver, which is passed a Jabber::JAX::Packet object, for delivery, and stop which will shutdown the component. 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.

Don't forget to create the corresponding entry int the jabber.xml config file such as:

<service id='echocomp'>
  <accept>
    <ip/>
    <port>7000</port>
    <secret>mysecret</secret>
  </accept>
</service>

VERSION

very new

AUTHOR

Piers Harding - but DizzyD ( author of JECL ) is the real star

SEE ALSO

Jabber::JAX::Packet, Jabber::JAX::Component, Jabber::JAX::Client, Jabber::Judo::Element