|Perl: the Markov chain saw|
How best to support IPv4/v6 in Perl serverby VinsWorldcom (Vicar)
|on Jan 26, 2012 at 16:04 UTC||Need Help??|
VinsWorldcom has asked for the
wisdom of the Perl Monks concerning the following question:
QUESTION:What's the best cross-platform / backward compatible way to support IPv4 and IPv6 in Perl servers?
My research / testing:
I have a few modules on CPAN that create simple servers for listening and parsing of messages (shameless plug: Net::Syslogd and Net::SNMPTrapd). Currently, they support IPv4 by creating the listener with IO::Socket::INET.
I've been doing some work / testing and some reading on Perl support for IPv6 lately (IPv6 Name Resolution). I'm wondering what the best way to support both IPv4 and IPv6 in a Perl server would be?
Currently, I've done something with IO::Select and both IO::Socket::INET/6. Psuedo code below:
The code works fine - no problem / debug there. According to 'corelist', Socket6, IO::Socket::INET6 and "the new drop-in replacement" IO::Socket::IP aren't in 5.12.3 (the version I'm using) and don't appear to be in 5.14 according to http://perldoc.perl.org/index-modules-I.html.
So what are your opinions on the best way to support IPv4 and IPv6 in Perl servers: