This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Upgrade to Net::Ping 2.17.
authorJarkko Hietaniemi <jhi@iki.fi>
Sun, 5 May 2002 01:53:24 +0000 (01:53 +0000)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 5 May 2002 01:53:24 +0000 (01:53 +0000)
p4raw-id: //depot/perl@16409

lib/Net/Ping.pm
lib/Net/Ping/CHANGES
lib/Net/Ping/README

index 6c61a47..f689047 100644 (file)
@@ -1,6 +1,6 @@
 package Net::Ping;
 
-# $Id: Ping.pm,v 1.31 2002/04/11 16:45:06 rob Exp $
+# $Id: Ping.pm,v 1.33 2002/05/03 21:54:59 rob Exp $
 
 require 5.002;
 require Exporter;
@@ -12,11 +12,11 @@ use FileHandle;
 use Socket qw( SOCK_DGRAM SOCK_STREAM SOCK_RAW PF_INET
                inet_aton inet_ntoa sockaddr_in );
 use Carp;
-use Errno qw(ECONNREFUSED);
+use POSIX qw(ECONNREFUSED);
 
 @ISA = qw(Exporter);
 @EXPORT = qw(pingecho);
-$VERSION = "2.16";
+$VERSION = "2.17";
 
 # Constants
 
@@ -26,6 +26,12 @@ $max_datasize = 1024;       # Maximum data bytes in a packet
 # The data we exchange with the server for the stream protocol
 $pingstring = "pingschwingping!\n";
 
+if ($^O =~ /Win32/i) {
+  # Hack to avoid this Win32 spewage:
+  # Your vendor has not defined POSIX macro ECONNREFUSED
+  *ECONNREFUSED = sub {10061;}; # "Unknown Error" Special Win32 Response?
+};
+
 # Description:  The pingecho() subroutine is provided for backward
 # compatibility with the original Net::Ping.  It accepts a host
 # name/IP and an optional timeout in seconds.  Create a tcp ping
@@ -367,8 +373,7 @@ sub ping_tcp
 
   $@ = ""; $! = 0;
   $ret = $self -> tcp_connect( $ip, $timeout);
-  $ret = 1 if $! == ECONNREFUSED  # Connection refused
-    || $@ =~ /Unknown Error/i;    # Special Win32 response?
+  $ret = 1 if $! == ECONNREFUSED;  # Connection refused
   $self->{"fh"}->close();
   return $ret;
 }
@@ -667,7 +672,7 @@ __END__
 
 Net::Ping - check a remote host for reachability
 
-$Id: Ping.pm,v 1.31 2002/04/11 16:45:06 rob Exp $
+$Id: Ping.pm,v 1.33 2002/05/03 21:54:59 rob Exp $
 
 =head1 SYNOPSIS
 
index 8bf3c91..86060b6 100644 (file)
@@ -1,6 +1,12 @@
 CHANGES
 -------
 
+2.17  May 03 18:00 2002
+       - RPM spec generalizations.
+         michael.mclagan@linux.org (Michael McLagan)
+       - Win32 compatibility changes.
+         (Didn't compile on Win32 since v2.11.)
+
 2.16  Apr 11 14:00 2002
        - Documentation changes.
        - Added INSTALL doc.
index ff39739..2b18447 100644 (file)
@@ -1,7 +1,7 @@
 NAME
     Net::Ping - check a remote host for reachability
 
-    $Id: Ping.pm,v 1.31 2002/04/11 16:45:06 rob Exp $
+    $Id: Ping.pm,v 1.33 2002/05/03 21:54:59 rob Exp $
 
 SYNOPSIS
         use Net::Ping;