summaryrefslogtreecommitdiff
path: root/systems/texlive/tlnet/tlpkg/tlperl/lib/Net/Ping.pm
diff options
context:
space:
mode:
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/Net/Ping.pm')
-rw-r--r--systems/texlive/tlnet/tlpkg/tlperl/lib/Net/Ping.pm27
1 files changed, 13 insertions, 14 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/Net/Ping.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/Net/Ping.pm
index 19bb51ec1a..b4c8f2f80b 100644
--- a/systems/texlive/tlnet/tlpkg/tlperl/lib/Net/Ping.pm
+++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/Net/Ping.pm
@@ -22,7 +22,7 @@ use Time::HiRes;
@ISA = qw(Exporter);
@EXPORT = qw(pingecho);
@EXPORT_OK = qw(wakeonlan);
-$VERSION = "2.74";
+$VERSION = "2.76";
# Globals
@@ -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
@@ -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);
@@ -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())
@@ -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;