http://www.perlmonks.org?node_id=730954

EDITED TO ADD: Unfortunately, it turns out that the README file for IO::Socket::INET6 says that it may in a future version lose the ability to talk IPv4. Which would totally kill what I'm doing here, which in turn makes me not want to put it on CPAN. Instead, I'll just point the relevant lines of code here. There's after all only about five of them...
use IO::Socket::INET; use IO::Socket::INET6; BEGIN { $::{'IO::'}{'Socket::'}{'INET::'} = $::{'IO::'}{'Socket::'}{'I +NET6::'} }
ORIGINAL POST:

I'm currently involved in one of the few projects in this world that uses real live IPv6. Not much and not exclusively, but some. Apart from a web frontend, the project is written in Perl. Which means that I need to use IPv6 from Perl. This is a less than positive experience.

The basics are there. There are modules that make writing new code that uses IPv6 as easy as it ever gets. The main one, IO::Socket::INET6, is a drop-in replacement for the core IO::Socket::INET. Easy as pie.

The problem is old modules. Since IPv6 support in Perl is implemented by separate modules from CPAN, old code doesn't automatically become v6 aware. If you're lucky, the author of the module has fixed it (Net::DNS is fine, for example). Most of the standard modules are not. libnet isn't. LWP isn't. If you want to fetch stuff from http://ipv6.google.com/ in Perl today, you're out of luck. Hack the module yourself, or call out to wget or curl.

However. Most of the these modules work just fine with IPv6 if you just replace IO::Socket::INET with IO::Socket::INET6. And we can do that after we load the modules, if we're willing to become overly intimate with perl's symbol tables.

Since I don't have time to wait for the modules to get fixed (if the lwp mailing list is anything to go by, that may take years even if I send in patches), I've written a short but evil module that messes with the symbol table for me. It works fine at least for Net::SMTP and LWP::Simple. I call it IPv6::Force at the moment, but that's not a good name.

So, a couple of questions for you lot.

  1. Is there any IPv6 activity going on in the Perl world that I have missed?
  2. What should I call my evil module?
  3. Should I upload it to CPAN?