Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

IPV6 Errors with IO::Socket

by jZed (Prior)
on Feb 02, 2017 at 15:14 UTC ( [id://1180853] : perlquestion . print w/replies, xml ) Need Help??

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

I have been using XML::Feed on CentOS and I am sporadically getting this in an endless loop
Use of uninitialized value $fam_listen in numeric ne (!=) at /usr/shar +e/perl5/IO/Socket/ line 226.
I do have the latest IO::Socket (edit: but not the latest version of IO::Socket::INET6) and I tried removing IPV6 from @INC in a BEGIN but no joy. Any thoughts on troubleshooting?

SOLVED: This is jZed. jZed posts on Perlmonks before checking if he has the latest version of the problem module. Don't be like jZed. Updating to IO::Socket::INET6 version 2.72 solved my problem. Another way to solve it, as Corion said below - use IO::Socket::SSL 'inet4' prior to using LWP or XML::Feed or other modules using sockets if you want to force use of IPV4 rather than IPV6.

Replies are listed 'Best First'.
Re: IPV6 Errors with IO::Socket
by poj (Abbot) on Feb 02, 2017 at 18:25 UTC

    Is that line number around here in IO::Socket::INET6 - what version do you have ? 2.72 ?

    for( my $r=0;$r<@rres;$r+=5 ) { for( my $l=0;$l<@lres;$l+=5) { my $fam_listen = $lres[$l]; next if $rres[$r] != $fam_listen; # must be same famil +y push @flr,[ $fam_listen,$lres[$l+3],$rres[$r+3] ]; } }

      I have version 1.31. Line 226 is :
      if ( $fam_listen != $family ) { next LOOP_LRES; }
      $fam_listen is set from the original call for a socket but is apparently sporadically missing on my OS. I can shut up the errors if I add an if($fam_listen) ... but tht would be wrong.
        If you really have version 1.31 then you are running a 15 year old version. In this case you should no longer wonder about problems but upgrade your system. But, a version of 1.31 never occurs in the ChangeLog of IO::Socket::INET6, i.e. it goes straight from 1.28 to 2.00. How did you determine the version of IO::Socket::INET6 (which is not the same as IO::Socket!)?
Re: IPV6 Errors with IO::Socket
by Phenomanan (Monk) on Feb 02, 2017 at 17:00 UTC

    Try to run:

     perl -mIO::Socket::INET6 -e ''

    If the output is: "Can't locate IO/Socket/ in @INC ", then you are missing a module for INET6.

    You will have to run this from the CPAN shell: cpan> install IO::Socket::INET6

    This should fix the issue.

      Thanks, my problem is that I DO have INET6 and it is misbehaving. I need to either find out how to fix it or disable use of IO::Socket::INET6 so that IO::Socket always uses IPV4.

        Grepping both IO::Socket 1.31 and IO::Socket 1.36 for "INET6" yields no results for me.

        Can you show us a short program that reproduces your problem and shows that IO::Socket loads IO:;:Socket::INET6?

        #!perl -w use strict; use Data::Dumper; use IO::Socket; # whatever you need to do to make the error message/warning show up in + print Dumper \%INC;

        Of course, you can always try to rename IO/Socket/ ;)

        Just based on some research, I think you might be able to get around this issue by using "IO::Socket::INET" instead of "IO::Socket::INET6". Haven't tested this though, but might be worth a try.


        Welcome back, Jeff!

        *My* tenacity goes to eleven...