[JDEV] Perl code sample needed...

rebbaj rebbaj rebbaj2000 at yahoo.co.uk
Sun Jan 26 10:11:31 CST 2003

Thanks Matt and Chris for the replies.
It seemed reasonable that one could write an algorighm as follows with the Net::Jabber pm.  What would the XXXX's be?  I would also like to do this with the returned presence data...
use Net::Jabber qw();

my $Connection = new Net::Jabber::Client();
#  request the roster from the server
my $iq_req = Net::Jabber::IQ->new();
$iq_req->SetIQ(type=>"get", id=>"mpt_1");

# is there a native call to do this?
$iq_req->InsertRawXML('<query xmlns="jabber:iq:roster"/>');


while(defined($Connection->Process())) { }
sub InIQ # callback routine
 my $sid = shift;
 my $iq = shift;
 $roster = $iq->XXXXXX(); # what should I be calling here?
 foreach $item (XXXXXXX) {
      print $item->XXXXX, "\n"; # print jid
      print $item->XXXXX, "\n"; # print name
      print $item->XXXXX, "\n"; # print ask
      print $item->XXXXX, "\n"; # print subscribe
      print $item->XXXXX, "\n"; # print group
 Chris Wilkes <cwilkes-jabber at ladro.com> wrote:On Sat, Jan 25, 2003 at 11:55:46PM +0000, rebbaj rebbaj wrote:
> I am trying to write a routine in Perl where I can send a iq roster
> request and then parse through all the responses such that I can put
> them in an array. While I could do this with a call such as "my
> $roster = $iq->GetXML()" followed by a bunch of regular expressions,
> this seems painfull.

What Perl module are you using to do the "$iq->GetXML()"? If you send
me your code that does that I can add code to split out the results.

With Yahoo! Mail you can get a bigger mailbox -- choose a size that fits your needs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.jabber.org/pipermail/jdev/attachments/20030126/03de5821/attachment-0002.htm>

More information about the JDev mailing list