Attached patch should fix this.
--
Paul Evans
=== modified file 'lib/IO/Socket/IP.pm'
--- lib/IO/Socket/IP.pm 2012-05-08 19:05:06 +0000
+++ lib/IO/Socket/IP.pm 2012-05-30 21:11:32 +0000
@@ -306,7 +306,8 @@
If neither C<Type> nor C<Proto> hints are provided, a default of
C<SOCK_STREAM> and C<IPPROTO_TCP> respectively will be set, to maintain
-compatibility with C<IO::Socket::INET>.
+compatibility with C<IO::Socket::INET>. Other named arguments that are not
+recognised are ignored.
If the constructor fails, it will set C<$@> to an appropriate error message;
this may be from C<$!> or it may be some other string; not every failure
@@ -370,20 +371,17 @@
my @localinfos;
my @peerinfos;
- $hints{flags} = ( delete $arg->{GetAddrInfoFlags} || 0 ) | $AI_ADDRCONFIG;
-
- # Check for definedness of args, but delete them anyway even if they're
- # not defined. Then the only remaining keys will be unrecognised ones.
-
- if( defined( my $family = delete $arg->{Family} ) ) {
+ $hints{flags} = ( $arg->{GetAddrInfoFlags} || 0 ) | $AI_ADDRCONFIG;
+
+ if( defined( my $family = $arg->{Family} ) ) {
$hints{family} = $family;
}
- if( defined( my $type = delete $arg->{Type} ) ) {
+ if( defined( my $type = $arg->{Type} ) ) {
$hints{socktype} = $type;
}
- if( defined( my $proto = delete $arg->{Proto} ) ) {
+ if( defined( my $proto = $arg->{Proto} ) ) {
unless( $proto =~ m/^\d+$/ ) {
my $protonum = getprotobyname( $proto );
defined $protonum or croak "Unrecognised protocol $proto";
@@ -407,7 +405,7 @@
$hints{socktype} = SOCK_DGRAM if $hints{protocol} == IPPROTO_UDP;
}
- if( my $info = delete $arg->{LocalAddrInfo} ) {
+ if( my $info = $arg->{LocalAddrInfo} ) {
ref $info eq "ARRAY" or croak "Expected 'LocalAddrInfo' to be an ARRAY ref";
@localinfos = @$info;
}
@@ -434,17 +432,15 @@
return;
}
}
- delete $arg->{LocalHost};
- delete $arg->{LocalService};
- if( my $info = delete $arg->{PeerAddrInfo} ) {
+ if( my $info = $arg->{PeerAddrInfo} ) {
ref $info eq "ARRAY" or croak "Expected 'PeerAddrInfo' to be an ARRAY ref";
@peerinfos = @$info;
}
elsif( defined $arg->{PeerHost} or defined $arg->{PeerService} ) {
- defined( my $host = delete $arg->{PeerHost} ) or
+ defined( my $host = $arg->{PeerHost} ) or
croak "Expected 'PeerHost'";
- defined( my $service = delete $arg->{PeerService} ) or
+ defined( my $service = $arg->{PeerService} ) or
croak "Expected 'PeerService'";
local $1; # Placate a taint-related bug; [perl #67962]
@@ -463,22 +459,20 @@
return;
}
}
- delete $arg->{PeerHost};
- delete $arg->{PeerService};
my @sockopts_enabled;
- push @sockopts_enabled, SO_REUSEADDR if delete $arg->{ReuseAddr};
- push @sockopts_enabled, SO_REUSEPORT if delete $arg->{ReusePort};
- push @sockopts_enabled, SO_BROADCAST if delete $arg->{Broadcast};
+ push @sockopts_enabled, SO_REUSEADDR if $arg->{ReuseAddr};
+ push @sockopts_enabled, SO_REUSEPORT if $arg->{ReusePort};
+ push @sockopts_enabled, SO_BROADCAST if $arg->{Broadcast};
- my $listenqueue = delete $arg->{Listen};
+ my $listenqueue = $arg->{Listen};
croak "Cannot Listen with a PeerHost" if defined $listenqueue and @peerinfos;
- my $blocking = delete $arg->{Blocking};
+ my $blocking = $arg->{Blocking};
defined $blocking or $blocking = 1;
- my $v6only = delete $arg->{V6Only};
+ my $v6only = $arg->{V6Only};
# IO::Socket::INET defines this key. IO::Socket::IP always implements the
# behaviour it requests, so we can ignore it, unless the caller is for some
@@ -486,9 +480,6 @@
if( defined $arg->{MultiHomed} and !$arg->{MultiHomed} ) {
croak "Cannot disable the MultiHomed parameter";
}
- delete $arg->{MultiHomed};
-
- keys %$arg and croak "Unexpected keys - " . join( ", ", sort keys %$arg );
my @infos;
foreach my $local ( @localinfos ? @localinfos : {} ) {