Esteemed Monks,

I developed a project in Linux, using among the others IO::Socket and Log::Log4perl. All fine. I then tried to put the same code in Windows using ActiveState Perl 5.8.8.817, but with much less luck. In the most weird way.

I saw the following error:

2006/07/03 16:19:06 IO::Socket::INET::new(): IO::Socket::INET: No such + file or directory at notifyd.pl line 229
so I said "aha! I'll isolate a little script to show there on PerlMonks!", and I isolated the offending code as follows:
#!/usr/bin/perl use strict; use warnings; use IO::Socket; use Log::Log4perl qw( :easy ); #Log::Log4perl->easy_init($DEBUG); # NOTE: COMMENTED HERE my %listener_parameters = ( Proto => 'udp', Blocking => 1, ReuseAddr => 1, ); my $listener = new IO::Socket::INET(%listener_parameters) or die "IO::Socket::INET::new(): '$@'"; __END__ C:\Documents and Settings\Administrator\Desktop\mms>perl case.pl IO::Socket::INET::new(): 'IO::Socket::INET: ' at case.pl line 13.
Note that Log::Log4perl->easy_init($DEBUG); is commented here - I'm using die - and ARGH! The code is obviously continuing to offend, but it has another message! Well, in the first shot I was using Log4perl, right? Let's restore it:
#!/usr/bin/perl use strict; use warnings; use IO::Socket; use Log::Log4perl qw( :easy ); Log::Log4perl->easy_init($DEBUG); # RESTORED LINE my %listener_parameters = ( Proto => 'udp', Blocking => 1, ReuseAddr => 1, ); my $listener = new IO::Socket::INET(%listener_parameters) or die "IO::Socket::INET::new(): '$@'"; __END__ C:\Documents and Settings\Administrator\Desktop\mms>perl case.pl IO::Socket::INET::new(): 'IO::Socket::INET: Bad file descriptor' at ca +se.pl line 13.
ARARGH! With the only call to easy_init() the error message has changed another time! The errors seem to be kind of consistent: each different version of the script always produces the same error message, but apart from this...

Please save me from this hell: what's going on?

Update: I'm using the indirect call notation here, but only because I tried all the flavours given the initial message of "No such file or directory". In my actual code I'm using IO::Socket::INET->new(%listener_parameters).

Update 2: I managed to eliminate the errors and get the UDP socket to work by eliminating the Blocking => 1 configuration. This is extremely weird, given the fact that this blocking behaviuour should be the default, and that I included it only for paranoic reasons.

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.

In reply to Complete mess with IO::Socket in ActivePerl 5.8.8.817 by polettix

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.