diff options
-rw-r--r-- | lib/Net/Ping.pm | 6 | ||||
-rw-r--r-- | lib/Net/Ping/CHANGES | 5 | ||||
-rw-r--r-- | lib/Net/Ping/README | 29 | ||||
-rw-r--r-- | lib/Net/Ping/t/110_icmp_inst.t | 8 | ||||
-rw-r--r-- | lib/Net/Ping/t/120_udp_inst.t | 4 | ||||
-rw-r--r-- | lib/Net/Ping/t/130_tcp_inst.t | 4 | ||||
-rw-r--r-- | lib/Net/Ping/t/140_stream_inst.t | 4 | ||||
-rw-r--r-- | lib/Net/Ping/t/200_ping_tcp.t | 26 | ||||
-rw-r--r-- | lib/Net/Ping/t/300_ping_stream.t | 26 |
9 files changed, 77 insertions, 35 deletions
diff --git a/lib/Net/Ping.pm b/lib/Net/Ping.pm index 642338c89d..3d3ab76842 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 143de044bb..65b03ed28e 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 53b4dab9b9..bde09f00a8 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 c617135271..9553f845ce 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 0dc64ad4cb..f7b77b1a39 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 af6ddaac17..00be5af03e 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 ce1b9e62e7..626b2e1f14 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 6fbd78b5c9..c417fcb91c 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 b60a500884..270650a2c3 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. |