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.
This commit is contained in:
Paul Evans 2023-08-16 21:34:46 -04:00 committed by James E Keenan
parent ccaf6336a7
commit 6ce03f50fc
28 changed files with 156 additions and 178 deletions

View File

@ -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

View File

@ -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/},

View File

@ -0,0 +1,4 @@
root = true
[*.{pm,pl,t}]
indent_size = 3

View File

@ -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<IO::Socket::IP> - 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<IO::Socket>'s default behaviour means that calling the
C<IO::Socket> constructor with either C<PF_INET> or C<PF_INET6> as the
C<Domain> parameter will yield an C<IO::Socket::IP> 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<ReuseAddr>.
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<EINVAL> 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<AF_INET> and C<AF_INET6> 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<IO::Socket::INET>; for more fine grained
control over connection timeouts, consider performing a nonblocking connect
directly.
This behaviour is copied inspired by C<IO::Socket::INET>; 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<getaddinfo> call with
the C<AI_ADDRCONFIG> 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<errno> 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<errno> 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<PeerAddrInfo> or C<LocalAddrInfo> arguments. This can be
achieved by using L<Net::LibAsyncNS>, or the C<getaddrinfo(3)> 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<select()>, but any similar mechanism should work
analogously. C<IO::Socket::IP> 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<LocalService> or C<PeerService> argument.
@ -1119,7 +1114,7 @@ Either of C<LocalService> or C<PeerService> (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<http>) 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<undef> 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<sockhost_service> or
C<peerhost_service> 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<IO::Socket::INET> and
C<IO::Socket::IP>.

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl
use v5;
use strict;
use v5.14;
use warnings;
use Test::More;

View File

@ -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" );

View File

@ -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 :

View File

@ -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 :

View File

@ -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" );

View File

@ -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" );

View File

@ -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 :

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl
use v5;
use strict;
use v5.14;
use warnings;
use Test::More;

View File

@ -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' );
}

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl
use v5;
use strict;
use v5.14;
use warnings;
use Test::More;

View File

@ -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 ],

View File

@ -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;

View File

@ -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,

View File

@ -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" );

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl
use v5;
use strict;
use v5.14;
use warnings;
use Test::More;

View File

@ -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 - $!";

View File

@ -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" );

View File

@ -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 );

View File

@ -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 - $!";

View File

@ -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' );

View File

@ -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' );

View File

@ -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' );

View File

@ -1,7 +1,6 @@
#!/usr/bin/perl
use v5;
use strict;
use v5.14;
use warnings;
use Test::More;

View File

@ -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