[jdev] Net::XMPP2 0.01 Released

Robin Redeker elmex at x-paste.de
Thu Jul 5 15:01:09 CDT 2007


Hi!

I've released the first version of Net::XMPP2 a Perl module for XMPP.

   http://search.cpan.org/dist/Net-XMPP2/

It offers a non-blocking API and multiple levels of abstraction
from a simple XML stream up to a multi-account client class.

For non-blocking it uses AnyEvent, a framework for multiple event loops
like Event, Gtk2 or Tk.

I wrote Net::XMPP2 as there was no XMPP module for Perl which allowed out
of the box non-blocking usage with AnyEvent and also because I didn't really
like the API of Net::XMPP (just a personal matter of taste).

Here is a simple example that connects to the account 'net_xmpp2 at jabber.org'
and sends a message to me 'elmex at jabber.org', and prints all incoming messages:

   #!/opt/perl/bin/perl
   use strict;
   use utf8;
   use Event;
   use AnyEvent;
   use Net::XMPP2::Client;

   my $j = AnyEvent->condvar;
   my $cl = Net::XMPP2::Client->new;
   $cl->add_account ('net_xmpp2 at jabber.org', 'test');
   $cl->reg_cb (
      connected => sub {
         $cl->send_message (
            "Hi! I'm too stupid to adjust examples!" => 'elmex at jabber.org'
         );
         0
      },
      message => sub {
         my ($cl, $acc, $msg) = @_;
         print "message from: " . $msg->from . ": " . $msg->any_body . "\n";
         1
      }
   );

   $cl->start;
   $j->wait;


There are still some _missing_ features in Net::XMPP2 such as:

   - in-band-registration isn't yet fully implemented and doesn't work yet
   - iq-auth isn't implemented but will come, even thought that it's deprecated
   - lots of XEPs that are quite nice to have
     (eg. Entity capabilities, ...)
   - MUC
   (for more look in the TODO file that comes with Net::XMPP2 Version 0.01 :-)

The version 0.01 also doesn't come with many examples, which is one of the main
things I'm going to fix until next release, along with in-band-registration and
iq-auth.

"Regular" usage should already be mostly stable as I'm already using it in my
own personal (yet unreleased) chat client (which I use daily) and already found
many bugs.

If anyone is interested in using this module: feel free to contact me via mail,
Jabber or IRC and ask questions and report bugs (patches are welcome to ease my
workload a bit :)


Greetings,
   Robin



More information about the JDev mailing list