eric256 has asked for the wisdom of the Perl Monks concerning the following question:

So google comes out with GoogleTalk on Jabber and I think cool! A new reason to play with jabber some more. I head over to get Net::Jabber and find it needs Net::XMPP which in turn needs XML::Stream. All would have gone fine, and CPAN would have done all the work, except XML::Stream locks up during testing. After t\buildxml......ok 3/56 it just sits there eating 100% CPU. I tried to look at the test file but it seems like a foriegn language to me.

So I went to CPAN and read the readme, says if you have trouble downgrade to 1.21. So I did, and it gives me the same error. So...does anyone have experience with XML::Stream? There are no mentions in the bug track or the files that I can find so any help is appreciated. I will submit a bug report too but I thought I'd check here in the hopes that someone else has tried to install this and found a solution. BTW perl -v reads This is perl, v5.8.6 built for MSWin32-x86-multi-thread and this is a WindowsXP Pro machine.

Thanks for any help or ideas!


___________
Eric Hodges

Replies are listed 'Best First'.
Re: XML Stream Freezing during test
by InfiniteSilence (Curate) on Aug 24, 2005 at 20:17 UTC
    I don't think this code is Windows friendly for the following reasons: a) When you are installing you are probably using
    perl makefile.pl nmake install nmake nmake test
    And you go nutty when you run the 'nmake test'. If you look in the /t folder where you expanded the .gz file you will find various test files with the .t extension. Inside of the buildxml.t file is where your nmake test is hanging up, particularly on line 81:
    my $sid = $stream->OpenFile("t/test.xml"); my %status; while( %status = $stream->Process()) ...
    Note: I had to change the path on Windows to "..\\t\\test.xml" to even get past this step. More debugging leads me to the infinite loop that is caused by trying to use IO::Select on a filehandle in windows (see line 1221+ in Stream.pm):
    my $buff = ""; while($self->{SIDS}->{newconnection}->{status} == 0) { $self->debug(5,"OpenFile: can_read(",join(",",$self->{SIDS}->{ +newconnection}->{select}->can_read(0)),")"); if ($self->{SIDS}->{newconnection}->{select}->can_read(0)) ...
    The can_read(0) function returns nothing and no error is generated. You can try this for yourself like this:
    C:\Temp\XML-Stream-1.22\t>perl -e "use IO::Select; open(H, qq|c:\\temp +\\foo.cpp|) or die $!; my $n = new IO::Select(H); print $n->can_read( +0); close(H);"
    I have tried all sorts of variations of the above using \*STDIN, etc. from the examples in the POD and always got the same result. It just doesn't appear to work on Windows. Bummer. The reality is that you will have to pay special attention to scripts/modules that were not built/tested on Windows because strange things might happen. For instance, last night I ran a script from one of merlyn's articles for creating your own mini CPAN. I started it at around 11:00 p.m. CST in an Emacs shell buffer so that I could look at output in the morning. When I awoke all of the CPAN modules were copied to my machine...and then immediately after they were all ERASED by the same script! The moral? Well, take your pick: MORAL #1) Don't expect everything to work on Windows and MORAL #2) Consider switching to Linux (I am actually leaning toward the latter myself).

    Celebrate Intellectual Diversity

      Yea i have a linux machine i can do this work on. Just didn't see anything any where to indicate it wouldn't work on windows, and i thought I had it running on windows before. Is this an IO::Select issue then? or just basic incompatibility of ideas?


      ___________
      Eric Hodges
Re: XML Stream Freezing during test
by davidrw (Prior) on Aug 24, 2005 at 19:56 UTC
Re: XML Stream Freezing during test
by nicholasrperez (Monk) on Aug 25, 2005 at 11:17 UTC
    As the (current) author of POE::Component::Jabber, I highly suggest you /not/ use XML::Stream. PoCo::Jabber::Client::XMPP will automatically handle all of the various layers of negotiation for you (including TLS). All you have to do is provide a input event and you are on your way to manipulating an active stream. There are even examples in the distro of using the various client classes. NPEREZ