Skip to content

Commit 4db7f47

Browse files
committed
Update Net-Ping to CPAN version 2.75
[DELTA] 2.75 2022-09-01 12:44:03 rurban Minor - Modernized the synopsis (rurban/Net-Ping#31) - Fixed a link in a comment (rurban/Net-Ping#25) META Changes - Remove some TEST_REQUIRES (rurban/Net-Ping#23) Test fixes - Support NO_NETWORK_TESTING=1 (rurban/Net-Ping#24) - Fix non-routable addresses for negative tests (rurban/Net-Ping#24)
1 parent 86afe6b commit 4db7f47

File tree

10 files changed

+61
-60
lines changed

10 files changed

+61
-60
lines changed

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ package Maintainers;
858858
},
859859

860860
'Net::Ping' => {
861-
'DISTRIBUTION' => 'RURBAN/Net-Ping-2.74.tar.gz',
861+
'DISTRIBUTION' => 'RURBAN/Net-Ping-2.75.tar.gz',
862862
'FILES' => q[dist/Net-Ping],
863863
'EXCLUDED' => [
864864
qr{^\.[awc]},

dist/Net-Ping/Changes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
CHANGES
22
-------
3+
2.75 2022-09-01 12:44:03 rurban
4+
Minor
5+
- Modernized the synopsis (PR #31)
6+
- Fixed a link in a comment (PR #25)
7+
META Changes
8+
- Remove some TEST_REQUIRES (PR #23)
9+
Test fixes
10+
- Support NO_NETWORK_TESTING=1 (PR #24)
11+
- Fix non-routable addresses for negative tests (PR #24)
312
2.74 2020-09-09 09:21:39 rurban
413
Features
514
- Add ICMPv6_NI_REPLY support.

dist/Net-Ping/lib/Net/Ping.pm

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use Time::HiRes;
2222
@ISA = qw(Exporter);
2323
@EXPORT = qw(pingecho);
2424
@EXPORT_OK = qw(wakeonlan);
25-
$VERSION = "2.74";
25+
$VERSION = "2.75";
2626

2727
# Globals
2828

@@ -1081,8 +1081,7 @@ sub tcp_connect
10811081

10821082
sub DESTROY {
10831083
my $self = shift;
1084-
if ($self->{'proto'} eq 'tcp' &&
1085-
$self->{'tcp_chld'}) {
1084+
if ($self->{'proto'} && ($self->{'proto'} eq 'tcp') && $self->{'tcp_chld'}) {
10861085
# Put that choking client out of its misery
10871086
kill "KILL", $self->{'tcp_chld'};
10881087
# Clean off the zombie
@@ -2004,13 +2003,13 @@ Net::Ping - check a remote host for reachability
20042003
20052004
use Net::Ping;
20062005
2007-
$p = Net::Ping->new();
2006+
my $p = Net::Ping->new();
20082007
print "$host is alive.\n" if $p->ping($host);
20092008
$p->close();
20102009
2011-
$p = Net::Ping->new("icmp");
2010+
my $p = Net::Ping->new("icmp");
20122011
$p->bind($my_addr); # Specify source interface of pings
2013-
foreach $host (@host_array)
2012+
foreach my $host (@host_array)
20142013
{
20152014
print "$host is ";
20162015
print "NOT " unless $p->ping($host, 2);
@@ -2019,11 +2018,11 @@ Net::Ping - check a remote host for reachability
20192018
}
20202019
$p->close();
20212020
2022-
$p = Net::Ping->new("icmpv6");
2023-
$ip = "[fd00:dead:beef::4e]";
2021+
my $p = Net::Ping->new("icmpv6");
2022+
my $ip = "[fd00:dead:beef::4e]";
20242023
print "$ip is alive.\n" if $p->ping($ip);
20252024
2026-
$p = Net::Ping->new("tcp", 2);
2025+
my $p = Net::Ping->new("tcp", 2);
20272026
# Try connecting to the www port instead of the echo port
20282027
$p->port_number(scalar(getservbyname("http", "tcp")));
20292028
while ($stop_time > time())
@@ -2035,19 +2034,19 @@ Net::Ping - check a remote host for reachability
20352034
undef($p);
20362035
20372036
# Like tcp protocol, but with many hosts
2038-
$p = Net::Ping->new("syn");
2037+
my $p = Net::Ping->new("syn");
20392038
$p->port_number(getservbyname("http", "tcp"));
2040-
foreach $host (@host_array) {
2039+
foreach my $host (@host_array) {
20412040
$p->ping($host);
20422041
}
2043-
while (($host,$rtt,$ip) = $p->ack) {
2042+
while (my ($host, $rtt, $ip) = $p->ack) {
20442043
print "HOST: $host [$ip] ACKed in $rtt seconds.\n";
20452044
}
20462045
20472046
# High precision syntax (requires Time::HiRes)
2048-
$p = Net::Ping->new();
2047+
my $p = Net::Ping->new();
20492048
$p->hires();
2050-
($ret, $duration, $ip) = $p->ping($host, 5.5);
2049+
my ($ret, $duration, $ip) = $p->ping($host, 5.5);
20512050
printf("$host [ip: $ip] is alive (packet return time: %.2f ms)\n",
20522051
1000 * $duration)
20532052
if $ret;

dist/Net-Ping/t/190_alarm.t

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,10 @@
44
# Based on code written by [email protected] (Radu Greab).
55

66
BEGIN {
7-
if ($ENV{PERL_CORE}) {
8-
unless ($ENV{PERL_TEST_Net_Ping}) {
9-
print "1..0 \# Skip: network dependent test\n";
10-
exit;
11-
}
7+
if ($ENV{NO_NETWORK_TESTING} ||
8+
($ENV{PERL_CORE}) && !$ENV{PERL_TEST_Net_Ping}) {
9+
print "1..0 \# Skip: network dependent test\n";
10+
exit;
1211
}
1312
unless (eval "require Socket") {
1413
print "1..0 \# Skip: no Socket\n";
@@ -29,7 +28,7 @@ use Test::More tests => 6;
2928
BEGIN {use_ok 'Net::Ping'};
3029

3130
# Hopefully this is never a routeable host
32-
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
31+
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";
3332

3433
eval {
3534
my $timeout = 11;

dist/Net-Ping/t/200_ping_tcp.t

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
use strict;
22

33
BEGIN {
4-
if ($ENV{PERL_CORE}) {
5-
unless ($ENV{PERL_TEST_Net_Ping}) {
6-
print "1..0 # Skip: network dependent test\n";
7-
exit;
8-
}
4+
if ($ENV{NO_NETWORK_TESTING} ||
5+
($ENV{PERL_CORE}) && !$ENV{PERL_TEST_Net_Ping}) {
6+
print "1..0 # Skip: network dependent test\n";
7+
exit;
98
}
109
unless (eval "require Socket") {
1110
print "1..0 \# Skip: no Socket\n";
@@ -18,7 +17,7 @@ BEGIN {
1817
}
1918

2019
# Hopefully this is never a routeable host
21-
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
20+
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";
2221

2322
# Remote network test using tcp protocol.
2423
#

dist/Net-Ping/t/250_ping_hires.t

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,11 @@
33
use strict;
44

55
BEGIN {
6-
if ($ENV{PERL_CORE}) {
7-
unless ($ENV{PERL_TEST_Net_Ping}) {
8-
print "1..0 # Skip: network dependent test\n";
9-
exit;
10-
}
11-
}
6+
if ($ENV{NO_NETWORK_TESTING} ||
7+
($ENV{PERL_CORE}) && !$ENV{PERL_TEST_Net_Ping}) {
8+
print "1..0 \# Skip: network dependent test\n";
9+
exit;
10+
}
1211
unless (eval "require Socket") {
1312
print "1..0 \# Skip: no Socket\n";
1413
exit;

dist/Net-Ping/t/300_ping_stream.t

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
use strict;
22
BEGIN {
3-
if ($ENV{PERL_CORE}) {
4-
unless ($ENV{PERL_TEST_Net_Ping}) {
5-
print "1..0 # Skip: network dependent test\n";
6-
exit;
7-
}
8-
}
3+
if ($ENV{NO_NETWORK_TESTING} ||
4+
($ENV{PERL_CORE}) && !$ENV{PERL_TEST_Net_Ping}) {
5+
print "1..0 \# Skip: network dependent test\n";
6+
exit;
7+
}
98
if ($^O eq 'freebsd') {
109
print "1..0 \# Skip: unreliable localhost resolver on $^O\n";
1110
exit;

dist/Net-Ping/t/400_ping_syn.t

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
use strict;
22

33
BEGIN {
4-
if ($ENV{PERL_CORE}) {
5-
unless ($ENV{PERL_TEST_Net_Ping}) {
6-
print "1..0 # Skip: network dependent test\n";
7-
exit;
8-
}
4+
if ($ENV{NO_NETWORK_TESTING} ||
5+
($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) {
6+
print "1..0 # Skip: network dependent test\n";
7+
exit;
98
}
109
unless (eval "require Socket") {
1110
print "1..0 \# Skip: no Socket\n";
@@ -30,10 +29,10 @@ BEGIN {
3029
# connection to remote networks, but you still want the tests
3130
# to pass, use the following:
3231
#
33-
# $ PERL_CORE=1 make test
32+
# $ NO_NETWORK_TESTING=1 make test
3433

3534
# Hopefully this is never a routeable host
36-
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
35+
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";
3736

3837
# Try a few remote servers
3938
my %webs = (

dist/Net-Ping/t/410_syn_host.t

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
use strict;
33

44
BEGIN {
5-
if ($ENV{PERL_CORE}) {
6-
unless ($ENV{PERL_TEST_Net_Ping}) {
7-
print "1..0 # Skip: network dependent test\n";
8-
exit;
9-
}
5+
if ($ENV{NO_NETWORK_TESTING} ||
6+
($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) {
7+
print "1..0 # Skip: network dependent test\n";
8+
exit;
109
}
1110
unless (eval "require Socket") {
1211
print "1..0 \# Skip: no Socket\n";
@@ -31,13 +30,13 @@ BEGIN {
3130
# connection to remote networks, but you still want the tests
3231
# to pass, use the following:
3332
#
34-
# $ PERL_CORE=1 make test
33+
# $ NO_NETWORK_TESTING=1 make test
3534

3635
# Try a few remote servers
3736
my %webs;
3837
BEGIN {
3938
# Hopefully this is never a routeable host
40-
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
39+
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";
4140

4241
%webs = (
4342
$fail_ip => 0,

dist/Net-Ping/t/420_ping_syn_port.t

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
use strict;
33

44
BEGIN {
5-
if ($ENV{PERL_CORE}) {
6-
unless ($ENV{PERL_TEST_Net_Ping}) {
7-
print "1..0 # Skip: network dependent test\n";
8-
exit;
9-
}
5+
if ($ENV{NO_NETWORK_TESTING} ||
6+
($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) {
7+
print "1..0 # Skip: network dependent test\n";
8+
exit;
109
}
1110
unless (eval "require Socket") {
1211
print "1..0 \# Skip: no Socket\n";
@@ -31,10 +30,10 @@ BEGIN {
3130
# connection to remote networks, but you still want the tests
3231
# to pass, use the following:
3332
#
34-
# $ PERL_CORE=1 make test
33+
# $ NO_NETWORK_TESTING=1 make test
3534

3635
# Hopefully this is never a routeable host
37-
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
36+
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";
3837

3938
# Try a few remote servers
4039
my %webs;

0 commit comments

Comments
 (0)