1

I did a test with the code found on the IO::Socket::IP page:

use strict;
use warnings;
use IO::Socket::IP -register;

 my $sock = IO::Socket->new(
    Domain    => PF_INET6,
    LocalHost => "::1",
    Listen    => 1,
 ) or die "Cannot create socket - $@\n";

 print "Created a socket of type " . ref($sock) . "\n";

And the output I get on a perl 5.8.8 machine is:

Cannot create socket - Address family for hostaname not supported

While on a slackware machine with perl 5.12.3 it succeed.

So, it seems that upgrading Socket.pm to the latest version isn't enough to enable ipv6 support on perl 5.8.8.

Zagorax
  • 11,440
  • 8
  • 44
  • 56
  • `HTTP::AppServer` uses `HTTP::Server::Simple` that uses the core `Socket` module. So IPv6 will only work with versions of perl that have an IPv6 capable `Socket` module. Which version of `Socket` do you use? – matthias krull Jul 18 '12 at 19:15
  • 1
    Zagorax: Hacking this to get it to work is the wrong way to go about things and will likely leave you with a multitude of obscure bugs. Is there nothing at all you can do to get an upgrade to Perl v5.10? – Borodin Jul 18 '12 at 19:19
  • @mugenkenichi, As I said, I installed the latest Socket module, it's version 2.002. – Zagorax Jul 18 '12 at 19:32
  • And does `Socket` work with IPv6 stand alone on your 5.8.8 machine? – matthias krull Jul 18 '12 at 19:33
  • @Borodin, Unfortunately not. I'm doing this work for the Genève CERN during the Google Summer of Code. Their virtual machine runs Scientific Linux 5, that is based on RHEL 5 (which has perl 5.8.8 installed). They have hundreds of virtual machines and it's unlikely they will upgrade perl core module on all of them... :( – Zagorax Jul 18 '12 at 19:37
  • @mugenkenichi, No, it doesn't. I did a test with IO::Socket::IP and I edited my question to consider the result. I need some more modules. Replacing `Socket.pm` wasn't enough. – Zagorax Jul 18 '12 at 20:10
  • Is this code run under "use strict"? I mean are you sure PF_INET6 is defined? Try to use bare number constant (according to socket.h PF_INET6 == 10) – s0me0ne Aug 04 '12 at 11:21
  • Yes, it does. I always add `use strict` and `use warnings` atop of my script. – Zagorax Aug 04 '12 at 17:47

2 Answers2

0

My best idea is to look at a list of module files your program has loaded (either explicitly or implcitly). This code should do the trick

use File::Spec;
print File::Spec->canonpath($_), "\n" for sort values %INC;

Look at each relevant file (obviously you can ignore things like strict.pm) to make sure the files you have updated are being used and to see if there is anything you have overlooked that could use an upgrade.

Borodin
  • 126,100
  • 9
  • 70
  • 144
0

As I already commented on the bug linked from your previous paste, HTTP::Server::Simple is simply not written for handling IPv6. It has lots of IPv4-specific code littered all over the place. You cannot enable this simply by installing some other module.

Once basic IPv6 support is working in Socket, independently of HTTP::Server::Simple, then you can go about fixing the code in HTTP::Server::Simple to support IPv6. To be clear here, this will involve editing lib/HTTP/Server/Simple.pm itself, and actually fixing the code. Remove the IPv4-specific parts and write some family-netural code instead; ideally using IO::Socket::IP itself rather than the raw Socket-using code it currently has. This will make it more standard and better supported in the future.

Again to summarise - the actual code needs rewriting here; no amount of mere module-installing will be sufficient.

LeoNerd
  • 8,344
  • 1
  • 29
  • 36
  • Hi, I'm quite sure you're right as you're the developer of Socket.pm, but the last version of HTTP::Server::Simple perfectly handle ipv6 with perl 5.12.3, so why it should be impossible to manually upgrade some perl 5.8.8 modules to make it working? – Zagorax Jul 20 '12 at 02:22
  • Probably the right question is: my test with IO:Socket:IP shows that Socket.pm stand alone doesn't work with perl 5.8.8... how can I make it working? – Zagorax Jul 20 '12 at 02:32
  • Oh I see, I wasn't aware that a newer `HTTP::Server::Simple` could manage it. That's more interesting in that case. – LeoNerd Jul 20 '12 at 12:29
  • LeoNerd, As I didn't find a solution yet, I changed the whole question to be more specific to the problem. – Zagorax Aug 04 '12 at 07:33