From: Jarkko Hietaniemi Date: Thu, 14 Feb 2002 16:03:50 +0000 (+0000) Subject: Upgrade to Net::Ping 2.11. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ddbbf5594fdb25c5e14e6dabd279ba57c66c1c11;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Net::Ping 2.11. p4raw-id: //depot/perl@14689 --- diff --git a/lib/Net/Ping.pm b/lib/Net/Ping.pm index 642338c..3d3ab76 100644 --- a/lib/Net/Ping.pm +++ b/lib/Net/Ping.pm @@ -1,6 +1,6 @@ package Net::Ping; -# $Id: Ping.pm,v 1.15 2001/12/26 20:55:55 rob Exp $ +# $Id: Ping.pm,v 1.16 2002/01/05 23:36:54 rob Exp $ require 5.002; require Exporter; @@ -15,7 +15,7 @@ use Carp; @ISA = qw(Exporter); @EXPORT = qw(pingecho); -$VERSION = "2.10"; +$VERSION = "2.11"; # Constants @@ -634,7 +634,7 @@ __END__ Net::Ping - check a remote host for reachability -$Id: Ping.pm,v 1.15 2001/12/26 20:55:55 rob Exp $ +$Id: Ping.pm,v 1.16 2002/01/05 23:36:54 rob Exp $ =head1 SYNOPSIS diff --git a/lib/Net/Ping/CHANGES b/lib/Net/Ping/CHANGES index 143de04..65b03ed 100644 --- a/lib/Net/Ping/CHANGES +++ b/lib/Net/Ping/CHANGES @@ -1,6 +1,11 @@ CHANGES ------- +2.11 Feb 02 12:00 2002 + - Test changes in case echo port is not available. + - Fix 110_icmp_inst.t to use icmp protocol + Spotted by craigberry@mac.com (Craig Berry) + 2.10 Dec 26 12:00 2001 - Added bind() function useful for clients with multiple network interfaces performing the ping check thanks to diff --git a/lib/Net/Ping/README b/lib/Net/Ping/README index 53b4dab..bde09f0 100644 --- a/lib/Net/Ping/README +++ b/lib/Net/Ping/README @@ -1,7 +1,7 @@ NAME Net::Ping - check a remote host for reachability - $Id: Ping.pm,v 1.13 2001/12/07 02:18:44 rob Exp $ + $Id: Ping.pm,v 1.16 2002/01/05 23:36:54 rob Exp $ SYNOPSIS use Net::Ping; @@ -11,6 +11,7 @@ SYNOPSIS $p->close(); $p = Net::Ping->new("icmp"); + $p->bind($my_addr); # Specify source interface of pings foreach $host (@host_array) { print "$host is "; @@ -93,6 +94,19 @@ DESCRIPTION otherwise. The maximum number of data bytes that can be specified is 1024. + $p->bind($local_addr); + Sets the source address from which pings will be sent. This must be + the address of one of the interfaces on the local host. $local_addr + may be specified as a hostname or as a text IP address such as + "192.168.1.1". + + If the protocol is set to "tcp", this method may be called any + number of times, and each call to the ping() method (below) will use + the most recent $local_addr. If the protocol is "icmp" or "udp", + then bind() must be called at most once per object, and (if it is + called at all) must be called before the first call to ping() for + that object. + $p->ping($host [, $timeout]); Ping the remote host and wait for a response. $host can be either the hostname or the IP number of the remote host. The optional @@ -169,9 +183,10 @@ NOTES module to be written which understands all of the different kinds of ICMP packets. -AUTHOR(S) - Current maintainer Net::Ping base code: +AUTHORS + Current maintainers: colinm@cpan.org (Colin McMillen) + bbb@cpan.org (Rob Brown) Stream protocol: bronson@trestle.com (Scott Bronson) @@ -183,12 +198,10 @@ AUTHOR(S) Original Net::Ping author: mose@ns.ccsn.edu (Russell Mosemann) - Compatibility porting: - bbb@cpan.org (Rob Brown) - COPYRIGHT - Copyright (c) 2001, Colin McMillen. All rights reserved. Copyright (c) - 2001, Rob Brown. All rights reserved. + Copyright (c) 2001, Colin McMillen. All rights reserved. + + Copyright (c) 2001, Rob Brown. All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself. diff --git a/lib/Net/Ping/t/110_icmp_inst.t b/lib/Net/Ping/t/110_icmp_inst.t index c617135..9553f84 100644 --- a/lib/Net/Ping/t/110_icmp_inst.t +++ b/lib/Net/Ping/t/110_icmp_inst.t @@ -15,5 +15,9 @@ plan tests => 2; # Everything loaded fine ok 1; -my $p = new Net::Ping "tcp"; -ok !!$p; +if ($> and $^O ne 'VMS') { + skip "icmp ping requires root privileges.", 1; +} else { + my $p = new Net::Ping "icmp"; + ok !!$p; +} diff --git a/lib/Net/Ping/t/120_udp_inst.t b/lib/Net/Ping/t/120_udp_inst.t index 0dc64ad..f7b77b1 100644 --- a/lib/Net/Ping/t/120_udp_inst.t +++ b/lib/Net/Ping/t/120_udp_inst.t @@ -6,6 +6,10 @@ BEGIN { print "1..0 \# Skip: no Socket\n"; exit; } + unless (getservbyname('echo', 'udp')) { + print "1..0 \# Skip: no echo port\n"; + exit; + } } use Test; diff --git a/lib/Net/Ping/t/130_tcp_inst.t b/lib/Net/Ping/t/130_tcp_inst.t index af6ddaa..00be5af 100644 --- a/lib/Net/Ping/t/130_tcp_inst.t +++ b/lib/Net/Ping/t/130_tcp_inst.t @@ -5,6 +5,10 @@ BEGIN { print "1..0 \# Skip: no Socket\n"; exit; } + unless (getservbyname('echo', 'udp')) { + print "1..0 \# Skip: no echo port\n"; + exit; + } } use Test; diff --git a/lib/Net/Ping/t/140_stream_inst.t b/lib/Net/Ping/t/140_stream_inst.t index ce1b9e6..626b2e1 100644 --- a/lib/Net/Ping/t/140_stream_inst.t +++ b/lib/Net/Ping/t/140_stream_inst.t @@ -5,6 +5,10 @@ BEGIN { print "1..0 \# Skip: no Socket\n"; exit; } + unless (getservbyname('echo', 'udp')) { + print "1..0 \# Skip: no echo port\n"; + exit; + } } use Test; diff --git a/lib/Net/Ping/t/200_ping_tcp.t b/lib/Net/Ping/t/200_ping_tcp.t index 6fbd78b..c417fcb 100644 --- a/lib/Net/Ping/t/200_ping_tcp.t +++ b/lib/Net/Ping/t/200_ping_tcp.t @@ -1,16 +1,20 @@ BEGIN { - if ($ENV{PERL_CORE}) { - unless ($ENV{PERL_TEST_Net_Ping}) { - print "1..0 # Skip: network dependent test\n"; - exit; - } - chdir 't' if -d 't'; - @INC = qw(../lib); - } - unless (eval "require Socket") { - print "1..0 \# Skip: no Socket\n"; - exit; + if ($ENV{PERL_CORE}) { + unless ($ENV{PERL_TEST_Net_Ping}) { + print "1..0 # Skip: network dependent test\n"; + exit; } + chdir 't' if -d 't'; + @INC = qw(../lib); + } + unless (eval "require Socket") { + print "1..0 \# Skip: no Socket\n"; + exit; + } + unless (getservbyname('echo', 'udp')) { + print "1..0 \# Skip: no echo port\n"; + exit; + } } # Remote network test using tcp protocol. diff --git a/lib/Net/Ping/t/300_ping_stream.t b/lib/Net/Ping/t/300_ping_stream.t index b60a500..270650a 100644 --- a/lib/Net/Ping/t/300_ping_stream.t +++ b/lib/Net/Ping/t/300_ping_stream.t @@ -1,16 +1,20 @@ BEGIN { - if ($ENV{PERL_CORE}) { - unless ($ENV{PERL_TEST_Net_Ping}) { - print "1..0 # Skip: network dependent test\n"; - exit; - } - chdir 't' if -d 't'; - @INC = qw(../lib); - } - unless (eval "require Socket") { - print "1..0 \# Skip: no Socket\n"; - exit; + if ($ENV{PERL_CORE}) { + unless ($ENV{PERL_TEST_Net_Ping}) { + print "1..0 # Skip: network dependent test\n"; + exit; } + chdir 't' if -d 't'; + @INC = qw(../lib); + } + unless (eval "require Socket") { + print "1..0 \# Skip: no Socket\n"; + exit; + } + unless (getservbyname('echo', 'udp')) { + print "1..0 \# Skip: no echo port\n"; + exit; + } } # Test of stream protocol using loopback interface.