Skip to content

Commit

Permalink
Update Net-Ping to CPAN version 2.75
Browse files Browse the repository at this point in the history
[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)
  • Loading branch information
toddr committed Oct 19, 2022
1 parent 86afe6b commit 4db7f47
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 60 deletions.
2 changes: 1 addition & 1 deletion Porting/Maintainers.pl
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ package Maintainers;
},

'Net::Ping' => {
'DISTRIBUTION' => 'RURBAN/Net-Ping-2.74.tar.gz',
'DISTRIBUTION' => 'RURBAN/Net-Ping-2.75.tar.gz',
'FILES' => q[dist/Net-Ping],
'EXCLUDED' => [
qr{^\.[awc]},
Expand Down
9 changes: 9 additions & 0 deletions dist/Net-Ping/Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
CHANGES
-------
2.75 2022-09-01 12:44:03 rurban
Minor
- Modernized the synopsis (PR #31)
- Fixed a link in a comment (PR #25)
META Changes
- Remove some TEST_REQUIRES (PR #23)
Test fixes
- Support NO_NETWORK_TESTING=1 (PR #24)
- Fix non-routable addresses for negative tests (PR #24)
2.74 2020-09-09 09:21:39 rurban
Features
- Add ICMPv6_NI_REPLY support.
Expand Down
27 changes: 13 additions & 14 deletions dist/Net-Ping/lib/Net/Ping.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use Time::HiRes;
@ISA = qw(Exporter);
@EXPORT = qw(pingecho);
@EXPORT_OK = qw(wakeonlan);
$VERSION = "2.74";
$VERSION = "2.75";

# Globals

Expand Down Expand Up @@ -1081,8 +1081,7 @@ sub tcp_connect

sub DESTROY {
my $self = shift;
if ($self->{'proto'} eq 'tcp' &&
$self->{'tcp_chld'}) {
if ($self->{'proto'} && ($self->{'proto'} eq 'tcp') && $self->{'tcp_chld'}) {
# Put that choking client out of its misery
kill "KILL", $self->{'tcp_chld'};
# Clean off the zombie
Expand Down Expand Up @@ -2004,13 +2003,13 @@ Net::Ping - check a remote host for reachability
use Net::Ping;
$p = Net::Ping->new();
my $p = Net::Ping->new();
print "$host is alive.\n" if $p->ping($host);
$p->close();
$p = Net::Ping->new("icmp");
my $p = Net::Ping->new("icmp");
$p->bind($my_addr); # Specify source interface of pings
foreach $host (@host_array)
foreach my $host (@host_array)
{
print "$host is ";
print "NOT " unless $p->ping($host, 2);
Expand All @@ -2019,11 +2018,11 @@ Net::Ping - check a remote host for reachability
}
$p->close();
$p = Net::Ping->new("icmpv6");
$ip = "[fd00:dead:beef::4e]";
my $p = Net::Ping->new("icmpv6");
my $ip = "[fd00:dead:beef::4e]";
print "$ip is alive.\n" if $p->ping($ip);
$p = Net::Ping->new("tcp", 2);
my $p = Net::Ping->new("tcp", 2);
# Try connecting to the www port instead of the echo port
$p->port_number(scalar(getservbyname("http", "tcp")));
while ($stop_time > time())
Expand All @@ -2035,19 +2034,19 @@ Net::Ping - check a remote host for reachability
undef($p);
# Like tcp protocol, but with many hosts
$p = Net::Ping->new("syn");
my $p = Net::Ping->new("syn");
$p->port_number(getservbyname("http", "tcp"));
foreach $host (@host_array) {
foreach my $host (@host_array) {
$p->ping($host);
}
while (($host,$rtt,$ip) = $p->ack) {
while (my ($host, $rtt, $ip) = $p->ack) {
print "HOST: $host [$ip] ACKed in $rtt seconds.\n";
}
# High precision syntax (requires Time::HiRes)
$p = Net::Ping->new();
my $p = Net::Ping->new();
$p->hires();
($ret, $duration, $ip) = $p->ping($host, 5.5);
my ($ret, $duration, $ip) = $p->ping($host, 5.5);
printf("$host [ip: $ip] is alive (packet return time: %.2f ms)\n",
1000 * $duration)
if $ret;
Expand Down
11 changes: 5 additions & 6 deletions dist/Net-Ping/t/190_alarm.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@
# Based on code written by [email protected] (Radu Greab).

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

# Hopefully this is never a routeable host
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";

eval {
my $timeout = 11;
Expand Down
11 changes: 5 additions & 6 deletions dist/Net-Ping/t/200_ping_tcp.t
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use strict;

BEGIN {
if ($ENV{PERL_CORE}) {
unless ($ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
exit;
}
if ($ENV{NO_NETWORK_TESTING} ||
($ENV{PERL_CORE}) && !$ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
exit;
}
unless (eval "require Socket") {
print "1..0 \# Skip: no Socket\n";
Expand All @@ -18,7 +17,7 @@ BEGIN {
}

# Hopefully this is never a routeable host
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";

# Remote network test using tcp protocol.
#
Expand Down
11 changes: 5 additions & 6 deletions dist/Net-Ping/t/250_ping_hires.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@
use strict;

BEGIN {
if ($ENV{PERL_CORE}) {
unless ($ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
exit;
}
}
if ($ENV{NO_NETWORK_TESTING} ||
($ENV{PERL_CORE}) && !$ENV{PERL_TEST_Net_Ping}) {
print "1..0 \# Skip: network dependent test\n";
exit;
}
unless (eval "require Socket") {
print "1..0 \# Skip: no Socket\n";
exit;
Expand Down
11 changes: 5 additions & 6 deletions dist/Net-Ping/t/300_ping_stream.t
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use strict;
BEGIN {
if ($ENV{PERL_CORE}) {
unless ($ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
exit;
}
}
if ($ENV{NO_NETWORK_TESTING} ||
($ENV{PERL_CORE}) && !$ENV{PERL_TEST_Net_Ping}) {
print "1..0 \# Skip: network dependent test\n";
exit;
}
if ($^O eq 'freebsd') {
print "1..0 \# Skip: unreliable localhost resolver on $^O\n";
exit;
Expand Down
13 changes: 6 additions & 7 deletions dist/Net-Ping/t/400_ping_syn.t
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use strict;

BEGIN {
if ($ENV{PERL_CORE}) {
unless ($ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
exit;
}
if ($ENV{NO_NETWORK_TESTING} ||
($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) {
print "1..0 # Skip: network dependent test\n";
exit;
}
unless (eval "require Socket") {
print "1..0 \# Skip: no Socket\n";
Expand All @@ -30,10 +29,10 @@ BEGIN {
# connection to remote networks, but you still want the tests
# to pass, use the following:
#
# $ PERL_CORE=1 make test
# $ NO_NETWORK_TESTING=1 make test

# Hopefully this is never a routeable host
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";

# Try a few remote servers
my %webs = (
Expand Down
13 changes: 6 additions & 7 deletions dist/Net-Ping/t/410_syn_host.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
use strict;

BEGIN {
if ($ENV{PERL_CORE}) {
unless ($ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
exit;
}
if ($ENV{NO_NETWORK_TESTING} ||
($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) {
print "1..0 # Skip: network dependent test\n";
exit;
}
unless (eval "require Socket") {
print "1..0 \# Skip: no Socket\n";
Expand All @@ -31,13 +30,13 @@ BEGIN {
# connection to remote networks, but you still want the tests
# to pass, use the following:
#
# $ PERL_CORE=1 make test
# $ NO_NETWORK_TESTING=1 make test

# Try a few remote servers
my %webs;
BEGIN {
# Hopefully this is never a routeable host
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";

%webs = (
$fail_ip => 0,
Expand Down
13 changes: 6 additions & 7 deletions dist/Net-Ping/t/420_ping_syn_port.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
use strict;

BEGIN {
if ($ENV{PERL_CORE}) {
unless ($ENV{PERL_TEST_Net_Ping}) {
print "1..0 # Skip: network dependent test\n";
exit;
}
if ($ENV{NO_NETWORK_TESTING} ||
($ENV{PERL_CORE} && !$ENV{PERL_TEST_Net_Ping})) {
print "1..0 # Skip: network dependent test\n";
exit;
}
unless (eval "require Socket") {
print "1..0 \# Skip: no Socket\n";
Expand All @@ -31,10 +30,10 @@ BEGIN {
# connection to remote networks, but you still want the tests
# to pass, use the following:
#
# $ PERL_CORE=1 make test
# $ NO_NETWORK_TESTING=1 make test

# Hopefully this is never a routeable host
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "172.29.249.249";
my $fail_ip = $ENV{NET_PING_FAIL_IP} || "192.0.2.0";

# Try a few remote servers
my %webs;
Expand Down

0 comments on commit 4db7f47

Please sign in to comment.