From 6ce03f50fc73c9cd20645be841aba2b328115783 Mon Sep 17 00:00:00 2001 From: Paul Evans Date: Wed, 16 Aug 2023 21:34:46 -0400 Subject: [PATCH] cpan/IO-Socket-IP - Update to version 0.42 0.42 2023-07-25 [CHANGES] * Put error string in `$IO::Socket::errstr` as done by IO::Socket v1.45 * Updated for Perl v5.14 - use `package NAME VERSION` syntax [BUGFIXES] * Fix typo 'behvior' (RT133467) (thanks ferivoz@riseup.net) * Fix for DragonflyBSD and IPV6_V6ONLY from core perl (RT148293) Committer: Regenerate 'customized' database. --- MANIFEST | 3 +- Porting/Maintainers.pl | 3 +- cpan/IO-Socket-IP/.editorconfig | 4 + cpan/IO-Socket-IP/lib/IO/Socket/IP.pm | 169 +++++++++--------- cpan/IO-Socket-IP/t/00use.t | 3 +- cpan/IO-Socket-IP/t/01local-client-v4.t | 7 +- cpan/IO-Socket-IP/t/02local-server-v4.t | 7 +- cpan/IO-Socket-IP/t/03local-cross-v4.t | 7 +- cpan/IO-Socket-IP/t/04local-client-v6.t | 5 +- cpan/IO-Socket-IP/t/05local-server-v6.t | 5 +- cpan/IO-Socket-IP/t/06local-cross-v6.t | 7 +- cpan/IO-Socket-IP/t/10args.t | 3 +- cpan/IO-Socket-IP/t/11sockopts.t | 11 +- cpan/IO-Socket-IP/t/12port-fallback.t | 3 +- cpan/IO-Socket-IP/t/13addrinfo.t | 11 +- cpan/IO-Socket-IP/t/14fileno.t | 5 +- cpan/IO-Socket-IP/t/15io-socket.t | 7 +- cpan/IO-Socket-IP/t/16v6only.t | 11 +- cpan/IO-Socket-IP/t/17gai-flags.t | 3 +- cpan/IO-Socket-IP/t/18fdopen.t | 5 +- cpan/IO-Socket-IP/t/19no-addrs.t | 9 +- cpan/IO-Socket-IP/t/20subclass.t | 14 +- cpan/IO-Socket-IP/t/21as-inet.t | 7 +- cpan/IO-Socket-IP/t/22timeout.t | 7 +- cpan/IO-Socket-IP/t/30nonblocking-connect.t | 7 +- .../t/31nonblocking-connect-internet.t | 7 +- cpan/IO-Socket-IP/t/99pod.t | 3 +- t/porting/customized.dat | 1 - 28 files changed, 156 insertions(+), 178 deletions(-) create mode 100644 cpan/IO-Socket-IP/.editorconfig diff --git a/MANIFEST b/MANIFEST index 63bbcc0124..722bf44529 100644 --- a/MANIFEST +++ b/MANIFEST @@ -1400,6 +1400,7 @@ cpan/IO-Compress/t/files/meta.xml IO-Compress cpan/IO-Compress/t/files/test.ods IO-Compress cpan/IO-Compress/t/files/testfile1.odt IO-Compress cpan/IO-Compress/t/globmapper.t IO::Compress +cpan/IO-Socket-IP/.editorconfig IO-Socket-IP cpan/IO-Socket-IP/lib/IO/Socket/IP.pm IO::Socket::IP cpan/IO-Socket-IP/t/00use.t IO::Socket::IP tests cpan/IO-Socket-IP/t/01local-client-v4.t IO::Socket::IP tests @@ -1420,7 +1421,7 @@ cpan/IO-Socket-IP/t/18fdopen.t IO::Socket::IP tests cpan/IO-Socket-IP/t/19no-addrs.t IO::Socket::IP tests cpan/IO-Socket-IP/t/20subclass.t IO::Socket::IP tests cpan/IO-Socket-IP/t/21as-inet.t IO::Socket::IP tests -cpan/IO-Socket-IP/t/22timeout.t +cpan/IO-Socket-IP/t/22timeout.t Test file related to IO::Socket::IP cpan/IO-Socket-IP/t/30nonblocking-connect.t IO::Socket::IP tests cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t IO::Socket::IP tests cpan/IO-Socket-IP/t/99pod.t IO::Socket::IP tests diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 67cebda8cc..b1e0d0be47 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -672,7 +672,8 @@ use File::Glob qw(:case); }, 'IO::Socket::IP' => { - 'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.41.tar.gz', + 'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.42.tar.gz', + 'SYNCINFO' => 'jkeenan on Wed Aug 16 21:34:20 2023', 'FILES' => q[cpan/IO-Socket-IP], 'EXCLUDED' => [ qr{^examples/}, diff --git a/cpan/IO-Socket-IP/.editorconfig b/cpan/IO-Socket-IP/.editorconfig new file mode 100644 index 0000000000..24b6e3b6cc --- /dev/null +++ b/cpan/IO-Socket-IP/.editorconfig @@ -0,0 +1,4 @@ +root = true + +[*.{pm,pl,t}] +indent_size = 3 diff --git a/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm b/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm index 2601c716af..3cdc17b965 100644 --- a/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm +++ b/cpan/IO-Socket-IP/lib/IO/Socket/IP.pm @@ -1,21 +1,13 @@ # You may distribute under the terms of either the GNU General Public License # or the Artistic License (the same terms as Perl itself) # -# (C) Paul Evans, 2010-2020 -- leonerd@leonerd.org.uk +# (C) Paul Evans, 2010-2023 -- leonerd@leonerd.org.uk -package IO::Socket::IP; +package IO::Socket::IP 0.42; -use v5; -use strict; +use v5.14; use warnings; -# $VERSION needs to be set before use base 'IO::Socket' -# - https://rt.cpan.org/Ticket/Display.html?id=92107 -BEGIN { - our $VERSION = '0.41_01'; - $VERSION = eval $VERSION; -} - use base qw( IO::Socket ); use Carp; @@ -72,19 +64,19 @@ C - Family-neutral IP socket supporting both IPv4 and IPv6 =head1 SYNOPSIS - use IO::Socket::IP; + use IO::Socket::IP; - my $sock = IO::Socket::IP->new( - PeerHost => "www.google.com", - PeerPort => "http", - Type => SOCK_STREAM, - ) or die "Cannot construct socket - $@"; + my $sock = IO::Socket::IP->new( + PeerHost => "www.google.com", + PeerPort => "http", + Type => SOCK_STREAM, + ) or die "Cannot construct socket - $IO::Socket::errstr"; - my $familyname = ( $sock->sockdomain == PF_INET6 ) ? "IPv6" : - ( $sock->sockdomain == PF_INET ) ? "IPv4" : - "unknown"; + my $familyname = ( $sock->sockdomain == PF_INET6 ) ? "IPv6" : + ( $sock->sockdomain == PF_INET ) ? "IPv4" : + "unknown"; - printf "Connected to google via %s\n", $familyname; + printf "Connected to google via %s\n", $familyname; =head1 DESCRIPTION @@ -109,15 +101,15 @@ Changing C's default behaviour means that calling the C constructor with either C or C as the C parameter will yield an C object. - use IO::Socket::IP -register; + use IO::Socket::IP -register; - my $sock = IO::Socket->new( - Domain => PF_INET6, - LocalHost => "::1", - Listen => 1, - ) or die "Cannot create socket - $@\n"; + my $sock = IO::Socket->new( + Domain => PF_INET6, + LocalHost => "::1", + Listen => 1, + ) or die "Cannot create socket - $IO::Socket::errstr\n"; - print "Created a socket of type " . ref($sock) . "\n"; + print "Created a socket of type " . ref($sock) . "\n"; Note that C<-register> is a global setting that applies to the entire program; it cannot be applied only for certain callers, removed, or limited by lexical @@ -155,9 +147,9 @@ sub import die "Cannot socket(PF_INET6) - $!"; if( setsockopt $testsock, IPPROTO_IPV6, IPV6_V6ONLY, 0 ) { - if ($^O eq "dragonfly") { + if( $^O eq "dragonfly") { # dragonflybsd 6.4 lies about successfully turning this off - if (getsockopt $testsock, IPPROTO_IPV6, IPV6_V6ONLY) { + if( getsockopt $testsock, IPPROTO_IPV6, IPV6_V6ONLY ) { return $can_disable_v6only = 0; } } @@ -287,10 +279,10 @@ common boolean options). For example, both options given below are equivalent to setting C. - Sockopts => [ - [ SOL_SOCKET, SO_REUSEADDR ], - [ SOL_SOCKET, SO_REUSEADDR, pack( "i", 1 ) ], - ] + Sockopts => [ + [ SOL_SOCKET, SO_REUSEADDR ], + [ SOL_SOCKET, SO_REUSEADDR, pack( "i", 1 ) ], + ] =item V6Only => BOOL @@ -307,12 +299,12 @@ Note that not all platforms support disabling this option. Some, at least OpenBSD and MirBSD, will fail with C if you attempt to disable it. To determine whether it is possible to disable, you may use the class method - if( IO::Socket::IP->CAN_DISABLE_V6ONLY ) { - ... - } - else { - ... - } + if( IO::Socket::IP->CAN_DISABLE_V6ONLY ) { + ... + } + else { + ... + } If your platform does not support disabling this option but you still want to listen for both C and C connections you will have to create @@ -343,9 +335,9 @@ timeout will apply to each connection attempt individually, rather than to the operation as a whole. Further note that the timeout does not apply to the initial hostname resolve operation, if connecting by hostname. -This behviour is copied inspired by C; for more fine grained -control over connection timeouts, consider performing a nonblocking connect -directly. +This behaviour is copied inspired by C; for more fine +grained control over connection timeouts, consider performing a nonblocking +connect directly. =back @@ -360,9 +352,9 @@ socket family to create. In this case, it performs a C call with the C flag, no host name, and a service name of C<"0">, and uses the family of the first returned result. -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 -necessarily has an associated C value. +If the constructor fails, it will set C<$IO::Socket::errstr> and C<$@> to +an appropriate error message; this may be from C<$!> or it may be some other +string; not every failure necessarily has an associated C value. =head2 new (one arg) @@ -500,7 +492,7 @@ sub _io_socket_ip__configure } if( $err ) { - $@ = "$err"; + $IO::Socket::errstr = $@ = "$err"; $! = EINVAL; return; } @@ -527,7 +519,7 @@ sub _io_socket_ip__configure } if( $err ) { - $@ = "$err"; + $IO::Socket::errstr = $@ = "$err"; $! = EINVAL; return; } @@ -605,7 +597,7 @@ sub _io_socket_ip__configure else { ( my $err, @infos ) = getaddrinfo( "", "0", \%hints ); if( $err ) { - $@ = "$err"; + $IO::Socket::errstr = $@ = "$err"; $! = EINVAL; return; } @@ -654,12 +646,14 @@ sub setup foreach my $sockopt ( @{ ${*$self}{io_socket_ip_sockopts} } ) { my ( $level, $optname, $value ) = @$sockopt; - $self->setsockopt( $level, $optname, $value ) or ( $@ = "$!", return undef ); + $self->setsockopt( $level, $optname, $value ) or + ( $IO::Socket::errstr = $@ = "$!", return undef ); } if( defined ${*$self}{io_socket_ip_v6only} and defined $AF_INET6 and $info->{family} == $AF_INET6 ) { my $v6only = ${*$self}{io_socket_ip_v6only}; - $self->setsockopt( IPPROTO_IPV6, IPV6_V6ONLY, pack "i", $v6only ) or ( $@ = "$!", return undef ); + $self->setsockopt( IPPROTO_IPV6, IPV6_V6ONLY, pack "i", $v6only ) or + ( $IO::Socket::errstr = $@ = "$!", return undef ); } if( defined( my $addr = $info->{localaddr} ) ) { @@ -668,7 +662,8 @@ sub setup } if( defined( my $listenqueue = ${*$self}{io_socket_ip_listenqueue} ) ) { - $self->listen( $listenqueue ) or ( $@ = "$!", return undef ); + $self->listen( $listenqueue ) or + ( $IO::Socket::errstr = $@ = "$!", return undef ); } if( defined( my $addr = $info->{peeraddr} ) ) { @@ -698,7 +693,7 @@ sub setup # Pick the most appropriate error, stringified $! = ( grep defined, @{ ${*$self}{io_socket_ip_errors}} )[0]; - $@ = "$!"; + $IO::Socket::errstr = $@ = "$!"; return undef; } @@ -1062,28 +1057,28 @@ a lookup using the C or C arguments. This can be achieved by using L, or the C function can be called in a child process. - use IO::Socket::IP; - use Errno qw( EINPROGRESS EWOULDBLOCK ); + use IO::Socket::IP; + use Errno qw( EINPROGRESS EWOULDBLOCK ); - my @peeraddrinfo = ... # Caller must obtain the getaddinfo result here + my @peeraddrinfo = ... # Caller must obtain the getaddinfo result here - my $socket = IO::Socket::IP->new( - PeerAddrInfo => \@peeraddrinfo, - Blocking => 0, - ) or die "Cannot construct socket - $@"; + my $socket = IO::Socket::IP->new( + PeerAddrInfo => \@peeraddrinfo, + Blocking => 0, + ) or die "Cannot construct socket - $@"; - while( !$socket->connect and ( $! == EINPROGRESS || $! == EWOULDBLOCK ) ) { - my $wvec = ''; - vec( $wvec, fileno $socket, 1 ) = 1; - my $evec = ''; - vec( $evec, fileno $socket, 1 ) = 1; + while( !$socket->connect and ( $! == EINPROGRESS || $! == EWOULDBLOCK ) ) { + my $wvec = ''; + vec( $wvec, fileno $socket, 1 ) = 1; + my $evec = ''; + vec( $evec, fileno $socket, 1 ) = 1; - select( undef, $wvec, $evec, undef ) or die "Cannot select - $!"; - } + select( undef, $wvec, $evec, undef ) or die "Cannot select - $!"; + } - die "Cannot connect - $!" if $!; + die "Cannot connect - $!" if $!; - ... + ... The example above uses C, but any similar mechanism should work analogously. C takes care when creating new socket filehandles @@ -1108,9 +1103,9 @@ of the following special forms then special parsing is applied. The value of the C<...Host> argument will be split to give both the hostname and port (or service name): - hostname.example.org:http # Host name - 192.0.2.1:80 # IPv4 address - [2001:db8::1]:80 # IPv6 address + hostname.example.org:http # Host name + 192.0.2.1:80 # IPv4 address + [2001:db8::1]:80 # IPv6 address In each case, the port or service name (e.g. C<80>) is passed as the C or C argument. @@ -1119,7 +1114,7 @@ Either of C or C (or their C<...Port> synonyms) can be either a service name, a decimal number, or a string containing both a service name and number, in a form such as - http(80) + http(80) In this case, the name (C) will be tried first, but if the resolver does not understand it then the port number (C<80>) will be used instead. @@ -1137,17 +1132,17 @@ Returns a 2-element list, containing either the split hostname and port description if it could be parsed, or the given address and C if it was not recognised. - IO::Socket::IP->split_addr( "hostname:http" ) - # ( "hostname", "http" ) + IO::Socket::IP->split_addr( "hostname:http" ) + # ( "hostname", "http" ) - IO::Socket::IP->split_addr( "192.0.2.1:80" ) - # ( "192.0.2.1", "80" ) + IO::Socket::IP->split_addr( "192.0.2.1:80" ) + # ( "192.0.2.1", "80" ) - IO::Socket::IP->split_addr( "[2001:db8::1]:80" ) - # ( "2001:db8::1", "80" ) + IO::Socket::IP->split_addr( "[2001:db8::1]:80" ) + # ( "2001:db8::1", "80" ) - IO::Socket::IP->split_addr( "something.else" ) - # ( "something.else", undef ) + IO::Socket::IP->split_addr( "something.else" ) + # ( "something.else", undef ) =cut @@ -1178,7 +1173,7 @@ numeric address). This can be especially useful when combined with the C or C methods. - say "Connected to ", IO::Socket::IP->join_addr( $sock->peerhost_service ); + say "Connected to ", IO::Socket::IP->join_addr( $sock->peerhost_service ); =cut @@ -1258,12 +1253,12 @@ and receive" behaviour of specifying this combination of options to C<::INET> when using C<::IP>, perform first a blocking connect, then afterwards turn the socket into nonblocking mode. - my $sock = IO::Socket::IP->new( - PeerHost => $peer, - Timeout => 20, - ) or die "Cannot connect - $@"; + my $sock = IO::Socket::IP->new( + PeerHost => $peer, + Timeout => 20, + ) or die "Cannot connect - $@"; - $sock->blocking( 0 ); + $sock->blocking( 0 ); This code will behave identically under both C and C. diff --git a/cpan/IO-Socket-IP/t/00use.t b/cpan/IO-Socket-IP/t/00use.t index 093fe8a89c..fdd4d61f97 100644 --- a/cpan/IO-Socket-IP/t/00use.t +++ b/cpan/IO-Socket-IP/t/00use.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; diff --git a/cpan/IO-Socket-IP/t/01local-client-v4.t b/cpan/IO-Socket-IP/t/01local-client-v4.t index b9e53884cb..f1176651de 100644 --- a/cpan/IO-Socket-IP/t/01local-client-v4.t +++ b/cpan/IO-Socket-IP/t/01local-client-v4.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -30,7 +29,7 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { LocalHost => "127.0.0.1", Type => Socket->$socktype, Proto => ( $socktype eq "SOCK_STREAM" ? "tcp" : "udp" ), # Because IO::Socket::INET is stupid and always presumes tcp - ) or die "Cannot listen on PF_INET - $@"; + ) or die "Cannot listen on PF_INET - $IO::Socket::errstr"; my $socket = IO::Socket::IP->new( PeerHost => "127.0.0.1", @@ -39,7 +38,7 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { ); ok( defined $socket, "IO::Socket::IP->new constructs a $socktype socket" ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); is( $socket->sockdomain, AF_INET, "\$socket->sockdomain for $socktype" ); is( $socket->socktype, Socket->$socktype, "\$socket->socktype for $socktype" ); diff --git a/cpan/IO-Socket-IP/t/02local-server-v4.t b/cpan/IO-Socket-IP/t/02local-server-v4.t index 88691532fc..9bf74ed7d3 100644 --- a/cpan/IO-Socket-IP/t/02local-server-v4.t +++ b/cpan/IO-Socket-IP/t/02local-server-v4.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -33,7 +32,7 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { ); ok( defined $testserver, "IO::Socket::IP->new constructs a $socktype socket" ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); is( $testserver->sockdomain, AF_INET, "\$testserver->sockdomain for $socktype" ); is( $testserver->socktype, Socket->$socktype, "\$testserver->socktype for $socktype" ); @@ -53,7 +52,7 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { PeerPort => $testserver->sockport, Type => Socket->$socktype, Proto => ( $socktype eq "SOCK_STREAM" ? "tcp" : "udp" ), # Because IO::Socket::INET is stupid and always presumes tcp - ) or die "Cannot connect to PF_INET - $@"; + ) or die "Cannot connect to PF_INET - $IO::Socket::errstr"; my $testclient = ( $socktype eq "SOCK_STREAM" ) ? $testserver->accept : diff --git a/cpan/IO-Socket-IP/t/03local-cross-v4.t b/cpan/IO-Socket-IP/t/03local-cross-v4.t index 63c17fbb94..dca1c89833 100644 --- a/cpan/IO-Socket-IP/t/03local-cross-v4.t +++ b/cpan/IO-Socket-IP/t/03local-cross-v4.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -14,13 +13,13 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { LocalHost => "127.0.0.1", LocalPort => "0", Type => Socket->$socktype, - ) or die "Cannot listen on PF_INET - $@"; + ) or die "Cannot listen on PF_INET - $IO::Socket::errstr"; my $socket = IO::Socket::IP->new( PeerHost => "127.0.0.1", PeerService => $testserver->sockport, Type => Socket->$socktype, - ) or die "Cannot connect on PF_INET - $@"; + ) or die "Cannot connect on PF_INET - $IO::Socket::errstr"; my $testclient = ( $socktype eq "SOCK_STREAM" ) ? $testserver->accept : diff --git a/cpan/IO-Socket-IP/t/04local-client-v6.t b/cpan/IO-Socket-IP/t/04local-client-v6.t index 7770911b8e..9073fae483 100644 --- a/cpan/IO-Socket-IP/t/04local-client-v6.t +++ b/cpan/IO-Socket-IP/t/04local-client-v6.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -54,7 +53,7 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { ); ok( defined $socket, "IO::Socket::IP->new constructs a $socktype socket" ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); is( $socket->sockdomain, $AF_INET6, "\$socket->sockdomain for $socktype" ); is( $socket->socktype, Socket->$socktype, "\$socket->socktype for $socktype" ); diff --git a/cpan/IO-Socket-IP/t/05local-server-v6.t b/cpan/IO-Socket-IP/t/05local-server-v6.t index 392078b273..05dd71ae51 100644 --- a/cpan/IO-Socket-IP/t/05local-server-v6.t +++ b/cpan/IO-Socket-IP/t/05local-server-v6.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -40,7 +39,7 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { ); ok( defined $testserver, "IO::Socket::IP->new constructs a $socktype socket" ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); is( $testserver->sockdomain, $AF_INET6, "\$testserver->sockdomain for $socktype" ); is( $testserver->socktype, Socket->$socktype, "\$testserver->socktype for $socktype" ); diff --git a/cpan/IO-Socket-IP/t/06local-cross-v6.t b/cpan/IO-Socket-IP/t/06local-cross-v6.t index d4f3bc30f9..7f63b63542 100644 --- a/cpan/IO-Socket-IP/t/06local-cross-v6.t +++ b/cpan/IO-Socket-IP/t/06local-cross-v6.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -17,13 +16,13 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) { LocalHost => "::1", LocalPort => "0", Type => Socket->$socktype, - ) or die "Cannot listen on PF_INET6 - $@"; + ) or die "Cannot listen on PF_INET6 - $IO::Socket::errstr"; my $socket = IO::Socket::IP->new( PeerHost => "::1", PeerService => $testserver->sockport, Type => Socket->$socktype, - ) or die "Cannot connect on PF_INET6 - $@"; + ) or die "Cannot connect on PF_INET6 - $IO::Socket::errstr"; my $testclient = ( $socktype eq "SOCK_STREAM" ) ? $testserver->accept : diff --git a/cpan/IO-Socket-IP/t/10args.t b/cpan/IO-Socket-IP/t/10args.t index 8361a50d83..20ebf1af07 100644 --- a/cpan/IO-Socket-IP/t/10args.t +++ b/cpan/IO-Socket-IP/t/10args.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; diff --git a/cpan/IO-Socket-IP/t/11sockopts.t b/cpan/IO-Socket-IP/t/11sockopts.t index e3bbd081f4..e0bee29eb6 100644 --- a/cpan/IO-Socket-IP/t/11sockopts.t +++ b/cpan/IO-Socket-IP/t/11sockopts.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -22,7 +21,7 @@ TODO: { Type => SOCK_STREAM, Listen => 1, ReuseAddr => 1, - ) or die "Cannot socket() - $@"; + ) or die "Cannot socket() - $IO::Socket::errstr"; ok( $sock->getsockopt( SOL_SOCKET, SO_REUSEADDR ), 'SO_REUSEADDR set' ); @@ -33,7 +32,7 @@ TODO: { Sockopts => [ [ SOL_SOCKET, SO_REUSEADDR ], ], - ) or die "Cannot socket() - $@"; + ) or die "Cannot socket() - $IO::Socket::errstr"; ok( $sock->getsockopt( SOL_SOCKET, SO_REUSEADDR ), 'SO_REUSEADDR set via Sockopts' ); } @@ -51,7 +50,7 @@ SKIP: { Type => SOCK_STREAM, Listen => 1, ReusePort => 1, - ) or die "Cannot socket() - $@"; + ) or die "Cannot socket() - $IO::Socket::errstr"; ok( $sock->getsockopt( SOL_SOCKET, SO_REUSEPORT ), 'SO_REUSEPORT set' ); } @@ -65,7 +64,7 @@ SKIP: { Broadcast => 1, ); skip "Privileges required to set broadcast on datagram socket", 1 if !$sock and $! == EACCES; - die "Cannot socket() - $@" unless $sock; + die "Cannot socket() - $IO::Socket::errstr" unless $sock; ok( $sock->getsockopt( SOL_SOCKET, SO_BROADCAST ), 'SO_BROADCAST set' ); } diff --git a/cpan/IO-Socket-IP/t/12port-fallback.t b/cpan/IO-Socket-IP/t/12port-fallback.t index bbf93d9ff9..1f209f9f26 100644 --- a/cpan/IO-Socket-IP/t/12port-fallback.t +++ b/cpan/IO-Socket-IP/t/12port-fallback.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; diff --git a/cpan/IO-Socket-IP/t/13addrinfo.t b/cpan/IO-Socket-IP/t/13addrinfo.t index 30709f8586..e8368cb6e6 100644 --- a/cpan/IO-Socket-IP/t/13addrinfo.t +++ b/cpan/IO-Socket-IP/t/13addrinfo.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -16,7 +15,7 @@ use Socket qw( SOCK_STREAM unpack_sockaddr_in getaddrinfo ); Listen => 1, LocalHost => "127.0.0.1", Type => SOCK_STREAM, - ) or die "Cannot listen on PF_INET - $@"; + ) or die "Cannot listen on PF_INET - $IO::Socket::errstr"; my ( $err, @peeraddrinfo ) = getaddrinfo( "127.0.0.1", $testserver->sockport, { socktype => SOCK_STREAM } ); $err and die "Cannot getaddrinfo 127.0.0.1 - $err"; @@ -26,7 +25,7 @@ use Socket qw( SOCK_STREAM unpack_sockaddr_in getaddrinfo ); ); ok( defined $socket, 'IO::Socket::IP->new( PeerAddrInfo => ... ) constructs a new socket' ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); is_deeply( [ unpack_sockaddr_in $socket->peername ], [ unpack_sockaddr_in $testserver->sockname ], @@ -43,12 +42,12 @@ use Socket qw( SOCK_STREAM unpack_sockaddr_in getaddrinfo ); ); ok( defined $socket, 'IO::Socket::IP->new( LocalAddrInfo => ... ) constructs a new socket' ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); my $testclient = IO::Socket::INET->new( PeerHost => "127.0.0.1", PeerPort => $socket->sockport, - ) or die "Cannot connect to localhost - $@"; + ) or die "Cannot connect to localhost - $IO::Socket::errstr"; is_deeply( [ unpack_sockaddr_in $socket->sockname ], [ unpack_sockaddr_in $testclient->peername ], diff --git a/cpan/IO-Socket-IP/t/14fileno.t b/cpan/IO-Socket-IP/t/14fileno.t index 6e9ae92317..edf041a4b4 100644 --- a/cpan/IO-Socket-IP/t/14fileno.t +++ b/cpan/IO-Socket-IP/t/14fileno.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -11,7 +10,7 @@ use Socket qw( AF_INET SOCK_STREAM ); socket( my $tmph, AF_INET, SOCK_STREAM, 0 ) or die "Cannot socket() - $!"; -my $socket = IO::Socket::IP->new or die "Cannot create IO::Socket::IP - $@"; +my $socket = IO::Socket::IP->new or die "Cannot create IO::Socket::IP - $IO::Socket::errstr"; $socket->socket( AF_INET, SOCK_STREAM, 0 ) or die "Cannot socket() - $!"; my $fileno = $socket->fileno; diff --git a/cpan/IO-Socket-IP/t/15io-socket.t b/cpan/IO-Socket-IP/t/15io-socket.t index 584ebfa87b..7cb913a08e 100644 --- a/cpan/IO-Socket-IP/t/15io-socket.t +++ b/cpan/IO-Socket-IP/t/15io-socket.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -20,7 +19,7 @@ use IO::Socket::IP -register; ); isa_ok( $sock, "IO::Socket::IP", 'IO::Socket->new( Domain => AF_INET )' ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); $sock = IO::Socket->new( Domain => AF_INET, @@ -47,7 +46,7 @@ SKIP: { ); isa_ok( $sock, "IO::Socket::IP", 'IO::Socket->new( Domain => AF_INET6 )' ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); $sock = IO::Socket->new( Domain => $AF_INET6, diff --git a/cpan/IO-Socket-IP/t/16v6only.t b/cpan/IO-Socket-IP/t/16v6only.t index 792ca2f4f5..19b027b133 100644 --- a/cpan/IO-Socket-IP/t/16v6only.t +++ b/cpan/IO-Socket-IP/t/16v6only.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -31,7 +30,7 @@ my $ECONNREFUSED_STR = "$!"; Type => SOCK_STREAM, V6Only => 1, GetAddrInfoFlags => 0, # disable AI_ADDRCONFIG - ) or die "Cannot listen on PF_INET6 - $@"; + ) or die "Cannot listen on PF_INET6 - $IO::Socket::errstr"; is( $listensock->getsockopt( IPPROTO_IPV6, IPV6_V6ONLY ), 1, 'IPV6_V6ONLY is 1 on $listensock' ); @@ -42,7 +41,7 @@ my $ECONNREFUSED_STR = "$!"; Type => SOCK_STREAM, GetAddrInfoFlags => 0, # disable AI_ADDRCONFIG ); - my $err = "$@"; + my $err = "$IO::Socket::errstr"; ok( !defined $testsock, 'Unable to connect PF_INET socket to PF_INET6 socket with V6Only true' ); like( $err, qr/\Q$ECONNREFUSED_STR/, 'Socket creation fails with connection refused' ); @@ -60,7 +59,7 @@ SKIP: { Type => SOCK_STREAM, V6Only => 0, GetAddrInfoFlags => 0, # disable AI_ADDRCONFIG - ) or die "Cannot listen on PF_INET6 - $@"; + ) or die "Cannot listen on PF_INET6 - $IO::Socket::errstr"; is( $listensock->getsockopt( IPPROTO_IPV6, IPV6_V6ONLY ), 0, 'IPV6_V6ONLY is 0 on $listensock' ); @@ -71,7 +70,7 @@ SKIP: { Type => SOCK_STREAM, GetAddrInfoFlags => 0, # disable AI_ADDRCONFIG ); - my $err = "$@"; + my $err = "$IO::Socket::errstr"; ok( defined $testsock, 'Connected PF_INET socket to PF_INET6 socket with V6Only false' ) or diag( "IO::Socket::IP->new failed - $err" ); diff --git a/cpan/IO-Socket-IP/t/17gai-flags.t b/cpan/IO-Socket-IP/t/17gai-flags.t index 4072981e45..d2ef6b3d66 100644 --- a/cpan/IO-Socket-IP/t/17gai-flags.t +++ b/cpan/IO-Socket-IP/t/17gai-flags.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; diff --git a/cpan/IO-Socket-IP/t/18fdopen.t b/cpan/IO-Socket-IP/t/18fdopen.t index d1a3cb6d1f..51efa1a583 100644 --- a/cpan/IO-Socket-IP/t/18fdopen.t +++ b/cpan/IO-Socket-IP/t/18fdopen.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -13,7 +12,7 @@ my $s1 = IO::Socket::IP->new( LocalHost => "127.0.0.1", Type => SOCK_STREAM, Listen => 1, -) or die "Cannot listen on AF_INET - $@"; +) or die "Cannot listen on AF_INET - $IO::Socket::errstr"; my $s2 = IO::Socket::IP->new; $s2->fdopen( $s1->fileno, 'r' ) or die "Cannot fdopen - $!"; diff --git a/cpan/IO-Socket-IP/t/19no-addrs.t b/cpan/IO-Socket-IP/t/19no-addrs.t index cba44ca71d..e9878c70fd 100644 --- a/cpan/IO-Socket-IP/t/19no-addrs.t +++ b/cpan/IO-Socket-IP/t/19no-addrs.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -14,7 +13,7 @@ use Socket qw( SOCK_STREAM AF_INET ); { my $sock = IO::Socket::IP->new( Family => AF_INET ); - my $save_exc = $@; + my $save_exc = $IO::Socket::errstr; ok( defined $sock, 'Constructor yields handle for Family => AF_INET' ) or diag( "Exception was $save_exc" ); @@ -31,7 +30,7 @@ SKIP: { skip "Unable to bind to ::1", 4; my $sock = IO::Socket::IP->new( Family => $AF_INET6 ); - my $save_exc = $@; + my $save_exc = $IO::Socket::errstr; ok( defined $sock, 'Constructor yields handle for Family => AF_INET6' ) or diag( "Exception was $save_exc" ); @@ -44,7 +43,7 @@ SKIP: { # what family { my $sock = IO::Socket::IP->new( Type => SOCK_STREAM ); - my $save_exc = $@; + my $save_exc = $IO::Socket::errstr; ok( defined $sock, 'Constructor yields handle for Type => SOCK_STREAM' ) or diag( "Exception was $save_exc" ); diff --git a/cpan/IO-Socket-IP/t/20subclass.t b/cpan/IO-Socket-IP/t/20subclass.t index f6ddbfff31..a1e8dfeda5 100644 --- a/cpan/IO-Socket-IP/t/20subclass.t +++ b/cpan/IO-Socket-IP/t/20subclass.t @@ -1,23 +1,26 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; use IO::Socket::IP; +package MySubclass { + use base qw( IO::Socket::IP ); +} + my $server = IO::Socket::IP->new( Listen => 1, LocalHost => "127.0.0.1", LocalPort => 0, -) or die "Cannot listen on PF_INET - $!"; +) or die "Cannot listen on PF_INET - $IO::Socket::errstr"; my $client = IO::Socket::IP->new( PeerHost => $server->sockhost, PeerPort => $server->sockport, -) or die "Cannot connect on PF_INET - $!"; +) or die "Cannot connect on PF_INET - $IO::Socket::errstr"; my $accepted = $server->accept( 'MySubclass' ) or die "Cannot accept - $!"; @@ -25,6 +28,3 @@ my $accepted = $server->accept( 'MySubclass' ) isa_ok( $accepted, 'MySubclass' ); done_testing; - -package MySubclass; -use base qw( IO::Socket::IP ); diff --git a/cpan/IO-Socket-IP/t/21as-inet.t b/cpan/IO-Socket-IP/t/21as-inet.t index 96e7efbb82..9cd3b1b0f0 100644 --- a/cpan/IO-Socket-IP/t/21as-inet.t +++ b/cpan/IO-Socket-IP/t/21as-inet.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -12,12 +11,12 @@ my $server = IO::Socket::IP->new( Listen => 1, LocalHost => "127.0.0.1", LocalPort => 0, -) or die "Cannot listen on PF_INET - $!"; +) or die "Cannot listen on PF_INET - $IO::Socket::errstr"; my $client = IO::Socket::IP->new( PeerHost => $server->sockhost, PeerPort => $server->sockport, -) or die "Cannot connect on PF_INET - $!"; +) or die "Cannot connect on PF_INET - $IO::Socket::errstr"; my $accepted = $server->accept or die "Cannot accept - $!"; diff --git a/cpan/IO-Socket-IP/t/22timeout.t b/cpan/IO-Socket-IP/t/22timeout.t index 80dce45015..4cc3bff3e9 100644 --- a/cpan/IO-Socket-IP/t/22timeout.t +++ b/cpan/IO-Socket-IP/t/22timeout.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -12,13 +11,13 @@ my $server = IO::Socket::IP->new( Listen => 1, LocalHost => "127.0.0.1", LocalPort => 0, -) or die "Cannot listen on PF_INET - $!"; +) or die "Cannot listen on PF_INET - $IO::Socket::errstr"; my $client = IO::Socket::IP->new( PeerHost => $server->sockhost, PeerPort => $server->sockport, Timeout => 0.1, -) or die "Cannot connect on PF_INET - $!"; +) or die "Cannot connect on PF_INET - $IO::Socket::errstr"; ok( defined $client, 'client constructed with Timeout' ); ok( $client->blocking, 'client is in blocking mode after connect' ); diff --git a/cpan/IO-Socket-IP/t/30nonblocking-connect.t b/cpan/IO-Socket-IP/t/30nonblocking-connect.t index c5109df032..20bc9a7a67 100644 --- a/cpan/IO-Socket-IP/t/30nonblocking-connect.t +++ b/cpan/IO-Socket-IP/t/30nonblocking-connect.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -28,7 +27,7 @@ my $testserver = IO::Socket::INET->new( Listen => 1, LocalHost => "127.0.0.1", Type => SOCK_STREAM, -) or die "Cannot listen on PF_INET - $@"; +) or die "Cannot listen on PF_INET - $IO::Socket::errstr"; my $socket = IO::Socket::IP->new( PeerHost => "127.0.0.1", @@ -38,7 +37,7 @@ my $socket = IO::Socket::IP->new( ); ok( defined $socket, 'IO::Socket::IP->new( Blocking => 0 ) constructs a socket' ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); ok( defined $socket->fileno, '$socket has a fileno immediately after construction' ); diff --git a/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t b/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t index d2be3f7ce7..340ea8cece 100644 --- a/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t +++ b/cpan/IO-Socket-IP/t/31nonblocking-connect-internet.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; @@ -32,7 +31,7 @@ SKIP: { ); ok( defined $socket, "defined \$socket for $test_host:$test_good_port" ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); ok( defined $socket->fileno, '$socket has fileno' ); @@ -71,7 +70,7 @@ SKIP: { ); ok( defined $socket, "defined \$socket for $test_host:$test_bad_port" ) or - diag( " error was $@" ); + diag( " error was $IO::Socket::errstr" ); ok( defined $socket->fileno, '$socket has fileno' ); diff --git a/cpan/IO-Socket-IP/t/99pod.t b/cpan/IO-Socket-IP/t/99pod.t index 91b19f1dad..d1972ce38b 100644 --- a/cpan/IO-Socket-IP/t/99pod.t +++ b/cpan/IO-Socket-IP/t/99pod.t @@ -1,7 +1,6 @@ #!/usr/bin/perl -use v5; -use strict; +use v5.14; use warnings; use Test::More; diff --git a/t/porting/customized.dat b/t/porting/customized.dat index 23c3d5e9d7..56d05b5845 100644 --- a/t/porting/customized.dat +++ b/t/porting/customized.dat @@ -8,7 +8,6 @@ Digest::MD5 cpan/Digest-MD5/t/files.t d3d8c88cb6849f73a15e8746ab62bafb67d3c981 ExtUtils::Constant cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Base.pm 7560e1018f806db5689dee78728ccb8374aea741 ExtUtils::Constant cpan/ExtUtils-Constant/t/Constant.t 165e9c7132b003fd192d32a737b0f51f9ba4999e Filter::Util::Call pod/perlfilter.pod d1e217d0bc6083755b9017050b8724472c58275a -IO::Socket::IP cpan/IO-Socket-IP/lib/IO/Socket/IP.pm a3390d0b3b617a0b810c75941bfc6e6d0be5b785 Locale::Maketext::Simple cpan/Locale-Maketext-Simple/lib/Locale/Maketext/Simple.pm 57ed38905791a17c150210cd6f42ead22a7707b6 MIME::Base64 cpan/MIME-Base64/Base64.xs ad617fe2d01932c35b92defa26d40aba601a95a8 MIME::Base64 cpan/MIME-Base64/lib/MIME/Base64.pm 18e38d197c7c83f96b24f48bef514e93908e6a82