Update IO-Socket-IP to CPAN version 0.29
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Tue, 25 Feb 2014 11:04:29 +0000 (11:04 +0000)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Tue, 25 Feb 2014 11:41:12 +0000 (11:41 +0000)
  [DELTA]

  0.29  2014/02/24 16:06:29
        [BUGFIXES]
         * Workaround for OSes that disobey AI_ADDRCONFIG and yield AIs on
           families the kernel will not support anyway (e.g. HPUX)
         * Workaround for OSes that lack getprotobyname() (e.g. Android)

Porting/Maintainers.pl
cpan/IO-Socket-IP/Changes
cpan/IO-Socket-IP/META.json
cpan/IO-Socket-IP/META.yml
cpan/IO-Socket-IP/Makefile.PL
cpan/IO-Socket-IP/lib/IO/Socket/IP.pm
cpan/IO-Socket-IP/t/19no-addrs.t

index 324034d..1dff36b 100755 (executable)
@@ -637,7 +637,7 @@ use File::Glob qw(:case);
     },
 
     'IO::Socket::IP' => {
-        'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.28.tar.gz',
+        'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.29.tar.gz',
         'FILES'        => q[cpan/IO-Socket-IP],
         'EXCLUDED'     => [
             qr{^examples/},
index ef3f738..e647142 100644 (file)
@@ -1,5 +1,11 @@
 Revision history for IO-Socket-IP
 
+0.29    2014/02/24 16:06:29
+        [BUGFIXES]
+         * Workaround for OSes that disobey AI_ADDRCONFIG and yield AIs on
+           families the kernel will not support anyway (e.g. HPUX)
+         * Workaround for OSes that lack getprotobyname() (e.g. Android)
+
 0.28    2014/02/10 16:17:59
         [CHANGES]
          * Renamed internal _configure method to _io_socket_ip__configure to
index 66b1744..b6e4390 100644 (file)
@@ -4,7 +4,7 @@
       "Paul Evans <leonerd@leonerd.org.uk>"
    ],
    "dynamic_config" : 1,
-   "generated_by" : "Module::Build version 0.4203",
+   "generated_by" : "Module::Build version 0.4204",
    "license" : [
       "perl_5"
    ],
@@ -29,7 +29,7 @@
    "provides" : {
       "IO::Socket::IP" : {
          "file" : "lib/IO/Socket/IP.pm",
-         "version" : "0.28"
+         "version" : "0.29"
       }
    },
    "release_status" : "stable",
@@ -38,5 +38,5 @@
          "http://dev.perl.org/licenses/"
       ]
    },
-   "version" : "0.28"
+   "version" : "0.29"
 }
index 9e8bb03..f860cc0 100644 (file)
@@ -3,21 +3,21 @@ abstract: 'Family-neutral IP socket supporting both IPv4 and IPv6'
 author:
   - 'Paul Evans <leonerd@leonerd.org.uk>'
 build_requires:
-  Test::More: 0.88
+  Test::More: '0.88'
 dynamic_config: 1
-generated_by: 'Module::Build version 0.4203, CPAN::Meta::Converter version 2.133380'
+generated_by: 'Module::Build version 0.4204, CPAN::Meta::Converter version 2.133380'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: IO-Socket-IP
 provides:
   IO::Socket::IP:
     file: lib/IO/Socket/IP.pm
-    version: 0.28
+    version: '0.29'
 requires:
-  IO::Socket: 0
-  Socket: 1.97
+  IO::Socket: '0'
+  Socket: '1.97'
 resources:
   license: http://dev.perl.org/licenses/
-version: 0.28
+version: '0.29'
index ba9c840..796159d 100644 (file)
@@ -1,4 +1,4 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.4203
+# Note: this file was auto-generated by Module::Build::Compat version 0.4204
 use ExtUtils::MakeMaker;
 WriteMakefile
 (
index 44d057f..30e0464 100644 (file)
@@ -7,7 +7,7 @@ package IO::Socket::IP;
 # $VERSION needs to be set before  use base 'IO::Socket'
 #  - https://rt.cpan.org/Ticket/Display.html?id=92107
 BEGIN {
-   $VERSION = '0.28';
+   $VERSION = '0.29';
 }
 
 use strict;
@@ -35,6 +35,9 @@ use Errno qw( EINVAL EINPROGRESS EISCONN );
 
 use constant HAVE_MSWIN32 => ( $^O eq "MSWin32" );
 
+# At least one OS (Android) is known not to have getprotobyname()
+use constant HAVE_GETPROTOBYNAME => defined eval { getprotobyname( "tcp" ) };
+
 my $IPv6_re = do {
    # translation of RFC 3986 3.2.2 ABNF to re
    my $IPv4address = do {
@@ -394,7 +397,9 @@ sub _io_socket_ip__configure
 
    if( defined( my $proto = $arg->{Proto} ) ) {
       unless( $proto =~ m/^\d+$/ ) {
-         my $protonum = getprotobyname( $proto );
+         my $protonum = HAVE_GETPROTOBYNAME
+            ? getprotobyname( $proto )
+            : eval { Socket->${\"IPPROTO_\U$proto"}() };
          defined $protonum or croak "Unrecognised protocol $proto";
          $proto = $protonum;
       }
@@ -518,24 +523,27 @@ sub _io_socket_ip__configure
 
    if( !@infos ) {
       # If there was a Family hint then create a plain unbound, unconnected socket
+      if( defined $hints{family} ) {
+         @infos = ( {
+            family   => $hints{family},
+            socktype => $hints{socktype},
+            protocol => $hints{protocol},
+         } );
+      }
       # If there wasn't, use getaddrinfo()'s AI_ADDRCONFIG side-effect to guess a
       # suitable family first.
-      if( !defined $hints{family} ) {
-         my ( $err, $addrinfo ) = getaddrinfo( "", "0", \%hints );
+      else {
+         ( my $err, @infos ) = getaddrinfo( "", "0", \%hints );
          if( $err ) {
             $@ = "$err";
             $! = EINVAL;
             return;
          }
 
-         $hints{family} = $addrinfo->{family};
+         # We'll take all the @infos anyway, because some OSes (HPUX) are known to
+         # ignore the AI_ADDRCONFIG hint and return AF_INET6 even if they don't
+         # support them
       }
-
-      @infos = ( {
-         family   => $hints{family},
-         socktype => $hints{socktype},
-         protocol => $hints{protocol},
-      } );
    }
 
    # In the nonblocking case, caller will be calling ->setup multiple times.
index 0ccb84f..f26eff4 100644 (file)
@@ -13,6 +13,9 @@ use Socket qw( SOCK_STREAM AF_INET );
 
 {
    my $sock = IO::Socket::IP->new( Family => AF_INET );
+   my $save_exc = $@;
+   ok( defined $sock, 'Constructor yields handle for Family => AF_INET' ) or
+      diag( "Exception was $save_exc" );
 
    ok( defined $sock->fileno, '$sock->fileno for Family => AF_INET' );
    is( $sock->sockdomain, AF_INET, '$sock->sockdomain for Family => AF_INET' );
@@ -21,12 +24,15 @@ use Socket qw( SOCK_STREAM AF_INET );
 
 SKIP: {
    my $AF_INET6 = eval { require Socket and Socket::AF_INET6() } or
-      skip "No AF_INET6", 3;
+      skip "No AF_INET6", 4;
 
    eval { IO::Socket::IP->new( LocalHost => "::1" ) } or
-      skip "Unable to bind to ::1", 3;
+      skip "Unable to bind to ::1", 4;
 
    my $sock = IO::Socket::IP->new( Family => $AF_INET6 );
+   my $save_exc = $@;
+   ok( defined $sock, 'Constructor yields handle for Family => AF_INET6' ) or
+      diag( "Exception was $save_exc" );
 
    ok( defined $sock->fileno, '$sock->fileno for Family => AF_INET6' );
    is( $sock->sockdomain, $AF_INET6, '$sock->sockdomain for Family => AF_INET6' );
@@ -37,6 +43,9 @@ SKIP: {
 # what family
 {
    my $sock = IO::Socket::IP->new( Type => SOCK_STREAM );
+   my $save_exc = $@;
+   ok( defined $sock, 'Constructor yields handle for Type => SOCK_STREAM' ) or
+      diag( "Exception was $save_exc" );
 
    ok( defined $sock->fileno, '$sock->fileno for Type => SOCK_STREAM' );
    is( $sock->socktype, SOCK_STREAM, '$sock->socktype for Type => SOCK_STREAM' );