Skip to content

Commit 00f06a3

Browse files
thibaultduponchelleerichermanbook
committed
cpan/IO-Socket-IP - Update to version 0.43
0.43 2024-11-25 [CHANGES] * Swapped unit tests from `Test::More` to `Test2::V0` * Fixed some documentation typoes (thanks Igor Sobrado Delgado) (RT157201) co-authored-by: Eric Herman <eric@freesa.org> co-authored-by: Philippe Bruhat (BooK) <book@cpan.org>
1 parent a3319b9 commit 00f06a3

25 files changed

+129
-121
lines changed

Porting/Maintainers.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,8 @@ package Maintainers;
676676
},
677677

678678
'IO::Socket::IP' => {
679-
'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.42.tar.gz',
680-
'SYNCINFO' => 'jkeenan on Wed Aug 16 21:34:20 2023',
679+
'DISTRIBUTION' => 'PEVANS/IO-Socket-IP-0.43.tar.gz',
680+
'SYNCINFO' => 'tib on Wed Dec 4 17:32:19 2024',
681681
'FILES' => q[cpan/IO-Socket-IP],
682682
'EXCLUDED' => [
683683
qr{^examples/},

cpan/IO-Socket-IP/lib/IO/Socket/IP.pm

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# You may distribute under the terms of either the GNU General Public License
22
# or the Artistic License (the same terms as Perl itself)
33
#
4-
# (C) Paul Evans, 2010-2023 -- leonerd@leonerd.org.uk
4+
# (C) Paul Evans, 2010-2024 -- leonerd@leonerd.org.uk
55

6-
package IO::Socket::IP 0.42;
6+
package IO::Socket::IP 0.43;
77

88
use v5.14;
99
use warnings;
@@ -64,6 +64,8 @@ C<IO::Socket::IP> - Family-neutral IP socket supporting both IPv4 and IPv6
6464
6565
=head1 SYNOPSIS
6666
67+
=for highlighter language=perl
68+
6769
use IO::Socket::IP;
6870
6971
my $sock = IO::Socket::IP->new(
@@ -83,7 +85,7 @@ C<IO::Socket::IP> - Family-neutral IP socket supporting both IPv4 and IPv6
8385
This module provides a protocol-independent way to use IPv4 and IPv6 sockets,
8486
intended as a replacement for L<IO::Socket::INET>. Most constructor arguments
8587
and methods are provided in a backward-compatible way. For a list of known
86-
differences, see the C<IO::Socket::INET> INCOMPATIBILITES section below.
88+
differences, see the C<IO::Socket::INET> INCOMPATIBILITIES section below.
8789
8890
It uses the C<getaddrinfo(3)> function to convert hostnames and service names
8991
or port numbers into sets of possible addresses to connect to or listen on.
@@ -313,7 +315,7 @@ two listening sockets, one bound to each protocol.
313315
=item MultiHomed
314316
315317
This C<IO::Socket::INET>-style argument is ignored, except if it is defined
316-
but false. See the C<IO::Socket::INET> INCOMPATIBILITES section below.
318+
but false. See the C<IO::Socket::INET> INCOMPATIBILITIES section below.
317319
318320
However, the behaviour it enables is always performed by C<IO::Socket::IP>.
319321
@@ -348,7 +350,7 @@ recognised are ignored.
348350
349351
If neither C<Family> nor any hosts or addresses are passed, nor any
350352
C<*AddrInfo>, then the constructor has no information on which to decide a
351-
socket family to create. In this case, it performs a C<getaddinfo> call with
353+
socket family to create. In this case, it performs a C<getaddrinfo> call with
352354
the C<AI_ADDRCONFIG> flag, no host name, and a service name of C<"0">, and
353355
uses the family of the first returned result.
354356
@@ -827,7 +829,7 @@ sub _unpack_sockaddr
827829

828830
=head2 sockhost_service
829831
830-
( $host, $service ) = $sock->sockhost_service( $numeric )
832+
( $host, $service ) = $sock->sockhost_service( $numeric );
831833
832834
Returns the hostname and service name of the local address (that is, the
833835
socket address given by the C<sockname> method).
@@ -852,25 +854,25 @@ sub sockhost_service
852854

853855
=head2 sockhost
854856
855-
$addr = $sock->sockhost
857+
$addr = $sock->sockhost;
856858
857859
Return the numeric form of the local address as a textual representation
858860
859861
=head2 sockport
860862
861-
$port = $sock->sockport
863+
$port = $sock->sockport;
862864
863865
Return the numeric form of the local port number
864866
865867
=head2 sockhostname
866868
867-
$host = $sock->sockhostname
869+
$host = $sock->sockhostname;
868870
869871
Return the resolved name of the local address
870872
871873
=head2 sockservice
872874
873-
$service = $sock->sockservice
875+
$service = $sock->sockservice;
874876
875877
Return the resolved name of the local port number
876878
@@ -884,7 +886,7 @@ sub sockservice { my $self = shift; scalar +( $self->_get_host_service( $self->
884886

885887
=head2 sockaddr
886888
887-
$addr = $sock->sockaddr
889+
$addr = $sock->sockaddr;
888890
889891
Return the local address as a binary octet string
890892
@@ -894,7 +896,7 @@ sub sockaddr { my $self = shift; _unpack_sockaddr $self->sockname }
894896

895897
=head2 peerhost_service
896898
897-
( $host, $service ) = $sock->peerhost_service( $numeric )
899+
( $host, $service ) = $sock->peerhost_service( $numeric );
898900
899901
Returns the hostname and service name of the peer address (that is, the
900902
socket address given by the C<peername> method), similar to the
@@ -917,25 +919,25 @@ sub peerhost_service
917919

918920
=head2 peerhost
919921
920-
$addr = $sock->peerhost
922+
$addr = $sock->peerhost;
921923
922924
Return the numeric form of the peer address as a textual representation
923925
924926
=head2 peerport
925927
926-
$port = $sock->peerport
928+
$port = $sock->peerport;
927929
928930
Return the numeric form of the peer port number
929931
930932
=head2 peerhostname
931933
932-
$host = $sock->peerhostname
934+
$host = $sock->peerhostname;
933935
934936
Return the resolved name of the peer address
935937
936938
=head2 peerservice
937939
938-
$service = $sock->peerservice
940+
$service = $sock->peerservice;
939941
940942
Return the resolved name of the peer port number
941943
@@ -949,7 +951,7 @@ sub peerservice { my $self = shift; scalar +( $self->_get_host_service( $self->
949951

950952
=head2 peeraddr
951953
952-
$addr = $peer->peeraddr
954+
$addr = $peer->peeraddr;
953955
954956
Return the peer address as a binary octet string
955957
@@ -1001,7 +1003,7 @@ BEGIN {
10011003

10021004
=head2 as_inet
10031005
1004-
$inet = $sock->as_inet
1006+
$inet = $sock->as_inet;
10051007
10061008
Returns a new L<IO::Socket::INET> instance wrapping the same filehandle. This
10071009
may be useful in cases where it is required, for backward-compatibility, to
@@ -1060,7 +1062,7 @@ called in a child process.
10601062
use IO::Socket::IP;
10611063
use Errno qw( EINPROGRESS EWOULDBLOCK );
10621064
1063-
my @peeraddrinfo = ... # Caller must obtain the getaddinfo result here
1065+
my @peeraddrinfo = ... # Caller must obtain the getaddrinfo result here
10641066
10651067
my $socket = IO::Socket::IP->new(
10661068
PeerAddrInfo => \@peeraddrinfo,
@@ -1103,10 +1105,14 @@ of the following special forms then special parsing is applied.
11031105
The value of the C<...Host> argument will be split to give both the hostname
11041106
and port (or service name):
11051107
1108+
=for highlighter
1109+
11061110
hostname.example.org:http # Host name
11071111
192.0.2.1:80 # IPv4 address
11081112
[2001:db8::1]:80 # IPv6 address
11091113
1114+
=for highlighter language=perl
1115+
11101116
In each case, the port or service name (e.g. C<80>) is passed as the
11111117
C<LocalService> or C<PeerService> argument.
11121118
@@ -1132,16 +1138,16 @@ Returns a 2-element list, containing either the split hostname and port
11321138
description if it could be parsed, or the given address and C<undef> if it was
11331139
not recognised.
11341140
1135-
IO::Socket::IP->split_addr( "hostname:http" )
1141+
IO::Socket::IP->split_addr( "hostname:http" );
11361142
# ( "hostname", "http" )
11371143
1138-
IO::Socket::IP->split_addr( "192.0.2.1:80" )
1144+
IO::Socket::IP->split_addr( "192.0.2.1:80" );
11391145
# ( "192.0.2.1", "80" )
11401146
1141-
IO::Socket::IP->split_addr( "[2001:db8::1]:80" )
1147+
IO::Socket::IP->split_addr( "[2001:db8::1]:80" );
11421148
# ( "2001:db8::1", "80" )
11431149
1144-
IO::Socket::IP->split_addr( "something.else" )
1150+
IO::Socket::IP->split_addr( "something.else" );
11451151
# ( "something.else", undef )
11461152
11471153
=cut
@@ -1219,7 +1225,7 @@ sub configure
12191225
$self->configure( { %$arg, Family => Socket::AF_INET6() } );
12201226
}
12211227

1222-
=head1 C<IO::Socket::INET> INCOMPATIBILITES
1228+
=head1 C<IO::Socket::INET> INCOMPATIBILITIES
12231229
12241230
=over 4
12251231

cpan/IO-Socket-IP/t/00use.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
use v5.14;
44
use warnings;
55

6-
use Test::More;
6+
use Test2::V0;
77

8-
use_ok( "IO::Socket::IP" );
8+
require IO::Socket::IP;
99

10+
pass( 'Modules loaded' );
1011
done_testing;

cpan/IO-Socket-IP/t/01local-client-v4.t

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use v5.14;
44
use warnings;
55

6-
use Test::More;
6+
use Test2::V0;
77

88
use IO::Socket::IP;
99

@@ -52,13 +52,13 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) {
5252
ok( $socket->connected, "\$socket is connected for $socktype" );
5353
ok( $socket->blocking, "\$socket is in blocking mode after connect for $socktype" );
5454

55-
is_deeply( [ unpack_sockaddr_in $socket->sockname ],
56-
[ unpack_sockaddr_in $testclient->peername ],
57-
"\$socket->sockname for $socktype" );
55+
is( [ unpack_sockaddr_in $socket->sockname ],
56+
[ unpack_sockaddr_in $testclient->peername ],
57+
"\$socket->sockname for $socktype" );
5858

59-
is_deeply( [ unpack_sockaddr_in $socket->peername ],
60-
[ unpack_sockaddr_in $testclient->sockname ],
61-
"\$socket->peername for $socktype" );
59+
is( [ unpack_sockaddr_in $socket->peername ],
60+
[ unpack_sockaddr_in $testclient->sockname ],
61+
"\$socket->peername for $socktype" );
6262

6363
is( $socket->peerhost, $INADDR_LOOPBACK_HOST, "\$socket->peerhost for $socktype" );
6464
is( $socket->peerport, $testserver->sockport, "\$socket->peerport for $socktype" );

cpan/IO-Socket-IP/t/02local-server-v4.t

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use v5.14;
44
use warnings;
55

6-
use Test::More;
6+
use Test2::V0;
77

88
use IO::Socket::IP;
99

@@ -43,8 +43,8 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) {
4343
ok( eval { $testserver->peerport; 1 }, "\$testserver->peerport does not die for $socktype" )
4444
or do { chomp( my $e = $@ ); diag( "Exception was: $e" ) };
4545

46-
is_deeply( { host => $testserver->peerhost, port => $testserver->peerport },
47-
{ host => undef, port => undef },
46+
is( { host => $testserver->peerhost, port => $testserver->peerport },
47+
{ host => undef, port => undef },
4848
'peerhost/peersock yield scalar' );
4949

5050
my $socket = IO::Socket::INET->new(
@@ -59,18 +59,18 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) {
5959
do { $testserver->connect( $socket->sockname ); $testserver };
6060

6161
ok( defined $testclient, "accepted test $socktype client" );
62-
isa_ok( $testclient, "IO::Socket::IP", "\$testclient for $socktype" );
62+
isa_ok( $testclient, [ "IO::Socket::IP" ], "\$testclient for $socktype" );
6363

6464
is( $testclient->sockdomain, AF_INET, "\$testclient->sockdomain for $socktype" );
6565
is( $testclient->socktype, Socket->$socktype, "\$testclient->socktype for $socktype" );
6666

67-
is_deeply( [ unpack_sockaddr_in $socket->sockname ],
68-
[ unpack_sockaddr_in $testclient->peername ],
69-
"\$socket->sockname for $socktype" );
67+
is( [ unpack_sockaddr_in $socket->sockname ],
68+
[ unpack_sockaddr_in $testclient->peername ],
69+
"\$socket->sockname for $socktype" );
7070

71-
is_deeply( [ unpack_sockaddr_in $socket->peername ],
72-
[ unpack_sockaddr_in $testclient->sockname ],
73-
"\$socket->peername for $socktype" );
71+
is( [ unpack_sockaddr_in $socket->peername ],
72+
[ unpack_sockaddr_in $testclient->sockname ],
73+
"\$socket->peername for $socktype" );
7474

7575
is( $testclient->sockport, $socket->peerport, "\$testclient->sockport for $socktype" );
7676
is( $testclient->peerport, $socket->sockport, "\$testclient->peerport for $socktype" );

cpan/IO-Socket-IP/t/03local-cross-v4.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use v5.14;
44
use warnings;
55

6-
use Test::More;
6+
use Test2::V0;
77

88
use IO::Socket::IP;
99

cpan/IO-Socket-IP/t/04local-client-v6.t

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use v5.14;
44
use warnings;
55

6-
use Test::More;
6+
use Test2::V0;
77

88
use IO::Socket::IP;
99
use Socket qw( inet_pton inet_ntop pack_sockaddr_in6 unpack_sockaddr_in6 IN6ADDR_LOOPBACK );
@@ -66,13 +66,13 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) {
6666

6767
ok( $socket->connected, "\$socket is connected for $socktype" );
6868

69-
is_deeply( [ unpack_sockaddr_in6_addrport( $socket->sockname ) ],
70-
[ unpack_sockaddr_in6_addrport( $testclient->peername ) ],
71-
"\$socket->sockname for $socktype" );
69+
is( [ unpack_sockaddr_in6_addrport( $socket->sockname ) ],
70+
[ unpack_sockaddr_in6_addrport( $testclient->peername ) ],
71+
"\$socket->sockname for $socktype" );
7272

73-
is_deeply( [ unpack_sockaddr_in6_addrport( $socket->peername ) ],
74-
[ unpack_sockaddr_in6_addrport( $testclient->sockname ) ],
75-
"\$socket->peername for $socktype" );
73+
is( [ unpack_sockaddr_in6_addrport( $socket->peername ) ],
74+
[ unpack_sockaddr_in6_addrport( $testclient->sockname ) ],
75+
"\$socket->peername for $socktype" );
7676

7777
is( $socket->peerhost, $IN6ADDR_LOOPBACK_HOST, "\$socket->peerhost for $socktype" );
7878
is( $socket->peerport, $testport, "\$socket->peerport for $socktype" );

cpan/IO-Socket-IP/t/05local-server-v6.t

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use v5.14;
44
use warnings;
55

6-
use Test::More;
6+
use Test2::V0;
77

88
use IO::Socket::IP;
99
use Socket qw( inet_pton inet_ntop pack_sockaddr_in6 unpack_sockaddr_in6 IN6ADDR_LOOPBACK );
@@ -64,18 +64,18 @@ foreach my $socktype (qw( SOCK_STREAM SOCK_DGRAM )) {
6464
do { $testserver->connect( $socket->sockname ); $testserver };
6565

6666
ok( defined $testclient, "accepted test $socktype client" );
67-
isa_ok( $testclient, "IO::Socket::IP", "\$testclient for $socktype" );
67+
isa_ok( $testclient, [ "IO::Socket::IP" ], "\$testclient for $socktype" );
6868

6969
is( $testclient->sockdomain, $AF_INET6, "\$testclient->sockdomain for $socktype" );
7070
is( $testclient->socktype, Socket->$socktype, "\$testclient->socktype for $socktype" );
7171

72-
is_deeply( [ unpack_sockaddr_in6_addrport( $socket->sockname ) ],
73-
[ unpack_sockaddr_in6_addrport( $testclient->peername ) ],
74-
"\$socket->sockname for $socktype" );
72+
is( [ unpack_sockaddr_in6_addrport( $socket->sockname ) ],
73+
[ unpack_sockaddr_in6_addrport( $testclient->peername ) ],
74+
"\$socket->sockname for $socktype" );
7575

76-
is_deeply( [ unpack_sockaddr_in6_addrport( $socket->peername ) ],
77-
[ unpack_sockaddr_in6_addrport( $testclient->sockname ) ],
78-
"\$socket->peername for $socktype" );
76+
is( [ unpack_sockaddr_in6_addrport( $socket->peername ) ],
77+
[ unpack_sockaddr_in6_addrport( $testclient->sockname ) ],
78+
"\$socket->peername for $socktype" );
7979

8080
my $peerport = ( Socket::unpack_sockaddr_in6 $socket->peername )[0];
8181
my $sockport = ( Socket::unpack_sockaddr_in6 $socket->sockname )[0];

cpan/IO-Socket-IP/t/06local-cross-v6.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use v5.14;
44
use warnings;
55

6-
use Test::More;
6+
use Test2::V0;
77

88
use IO::Socket::IP;
99

0 commit comments

Comments
 (0)