Skip Menu |

This queue is for tickets about the Net-Frame CPAN distribution.

Report information
The Basics
Id: 56935
Status: resolved
Priority: 0/
Queue: Net-Frame

People
Owner: gomor [...] cpan.org
Requestors: danielh [...] e2eresolutions.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.06
Fixed in: 1.09



the attached patch makes the Socket6 package optional as it's a dependency hell that most people might not wish to install
Subject: Net-Frame-1.06.diff
diff -rcN Net-Frame-1.06/lib/Net/Frame/Layer6.pm Net-Frame-1.06-DH/lib/Net/Frame/Layer6.pm *** Net-Frame-1.06/lib/Net/Frame/Layer6.pm 1969-12-31 19:00:00.000000000 -0500 --- Net-Frame-1.06-DH/lib/Net/Frame/Layer6.pm 2010-01-20 13:11:54.657914957 -0500 *************** *** 0 **** --- 1,36 ---- + package Layer6; + + eval { + require Socket6; + require Net::IPv6Addr; + + Socket6->import(qw(NI_NUMERICHOST NI_NUMERICSERV inet_pton inet_ntop getaddrinfo getnameinfo)); + }; + + if ($@) { + warn("Socket6 is missing. this is not fatal and may be ignored if you do not require IPv6"); + 1; + } + + sub getHostIpv6Addr { + my ($name) = @_; + + return undef unless $name; + return $name if Net::IPv6Addr::is_ipv6($name); + + my @res = getaddrinfo($name, 'ssh', AF_INET6, SOCK_STREAM); + if (@res >= 5) { + my ($ipv6) = getnameinfo($res[3], NI_NUMERICHOST | NI_NUMERICSERV); + $ipv6 =~ s/%.*$//; + return $ipv6; + } + else { + carp("@{[(caller(0))[3]]}: unable to resolv `$name' hostname\n"); + } + undef; + } + sub inet6Aton { inet_pton(AF_INET6, shift()) } + sub inet6Ntoa { inet_ntop(AF_INET6, shift()) } + + + 1; diff -rcN Net-Frame-1.06/lib/Net/Frame/Layer.pm Net-Frame-1.06-DH/lib/Net/Frame/Layer.pm *** Net-Frame-1.06/lib/Net/Frame/Layer.pm 2009-05-23 09:32:36.000000000 -0400 --- Net-Frame-1.06-DH/lib/Net/Frame/Layer.pm 2010-01-20 13:11:44.245315139 -0500 *************** *** 96,104 **** # use Socket; ! use Socket6 qw(NI_NUMERICHOST NI_NUMERICSERV inet_pton inet_ntop getaddrinfo ! getnameinfo); ! require Net::IPv6Addr; sub getHostIpv4Addr { my ($name) = @_; --- 96,102 ---- # use Socket; ! use Net::Frame::Layer6; sub getHostIpv4Addr { my ($name) = @_; *************** *** 124,152 **** return (); } - sub getHostIpv6Addr { - my ($name) = @_; - - return undef unless $name; - return $name if Net::IPv6Addr::is_ipv6($name); - - my @res = getaddrinfo($name, 'ssh', AF_INET6, SOCK_STREAM); - if (@res >= 5) { - my ($ipv6) = getnameinfo($res[3], NI_NUMERICHOST | NI_NUMERICSERV); - $ipv6 =~ s/%.*$//; - return $ipv6; - } - else { - carp("@{[(caller(0))[3]]}: unable to resolv `$name' hostname\n"); - } - undef; - } - sub inetAton { inet_aton(shift()) } sub inetNtoa { inet_ntoa(shift()) } - sub inet6Aton { inet_pton(AF_INET6, shift()) } - sub inet6Ntoa { inet_ntop(AF_INET6, shift()) } - sub getRandomHighPort { my $highPort = int rand 0xffff; $highPort += 1024 if $highPort < 1025; --- 122,129 ----
Subject: Fixed in Net::Frame 1.10
Fixed in Net::Frame 1.10, contributed by Andrew Feren.