[jdev] XML::Stream question.....

troyer at xs4all.nl troyer at xs4all.nl
Sun Feb 22 08:18:13 CST 2004

Hello everyone,
I am trying to build a rather simple perl script using the Ryan Eatmon's
XML::Stream library.  Unfortunately, I am having a hard time getting the
Send method to work.  The send method requires both a sid (stream id)
and a
XML string.  Below is the script that I am using.  Upto about line 18
everything works fine.  On line 18, I would like to send out the xml:
type="get"><query xmlns="jabber:iq:auth"/></iq>
I am assuming that the sid is the $stream hash?  Am I misunderstanding
  use XML::Stream qw(Tree);
  use Data::Dumper;
  my $already_sent = 0;
  my $stream = new XML::Stream(debug=>"stdout", debuglevel=>3);
  $stream->Connect(hostname => "compaq",
                   port => 5222,
                   namespace => "jabber:client",
                   timeout => undef) || die $!;
  while(1) {
            if (!$already_sent) {
                        # Call to Send below does not work.  What am I
                        $stream->Send($stream,'<iq type="get"><query
                        $already_sent = 1;
  sub noder
    my $sid = shift;
    my $node = shift;
    # do something with $node
            print Dumper \$node

More information about the JDev mailing list