Skip Menu |

This queue is for tickets about the Net-Ping CPAN distribution.

Report information
The Basics
Id: 43907
Status: rejected
Priority: 0/
Queue: Net-Ping

People
Owner: Nobody in particular
Requestors: zgreenfelder [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: bug or design?
Date: Fri, 6 Mar 2009 13:38:58 -0500
To: bug-Net-Ping [...] rt.cpan.org
From: zGreenfelder <zgreenfelder [...] gmail.com>
Net::Ping seems to only accept hostnames; it'd be nice if it also took IP addresses. root@gir|/root/pox> uname -a Linux gir 2.6.22.18-0.2-default #1 SMP 2008-06-09 13:53:20 +0200 i686 athlon i386 GNU/Linux open suse 10.3 root@gir|/root/pox> perl -v This is perl, v5.8.8 built for i586-linux-thread-multi Copyright 1987-2006, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. reproduce: root@gir|/root/pox> ping gir PING gir.zep.net (192.168.1.5) 56(84) bytes of data. 64 bytes from gir.zep.net (192.168.1.5): icmp_seq=1 ttl=64 time=0.064 ms 64 bytes from gir.zep.net (192.168.1.5): icmp_seq=2 ttl=64 time=0.077 ms 64 bytes from gir.zep.net (192.168.1.5): icmp_seq=3 ttl=64 time=0.099 ms --- gir.zep.net ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2000ms rtt min/avg/max/mdev = 0.064/0.080/0.099/0.014 ms root@gir|/root/pox> more 1 #!/usr/bin/perl use Net::Ping; $p=Net::Ping->new(); print "gir alive.\n" if $p->ping(gir); $p->close(); $p=Net::Ping->new(); if ($p->ping(192.168.1.5)){ print "192.168.1.5 alive.\n " ; } else{ print "no ping from 192.168.1.5\n"; } $p->close(); #end script root@gir|/root/pox> perl 1 gir alive. no ping from 192.168.1.5 -- Even the Magic 8 ball has an opinion on email clients: Outlook not so good.
On Fri Mar 06 13:39:37 2009, zgreenfelder@gmail.com wrote: Show quoted text
> Net::Ping seems to only accept hostnames; it'd be nice if it also took > IP addresses. >
It does accept IP addresses. There are bugs in your script. See my version below. Steve #!perl -w use strict; use Net::Ping; my $p=Net::Ping->new(); print "gir alive.\n" if $p->ping("gir"); $p->close(); $p=Net::Ping->new(); if ($p->ping("192.168.1.5")){ print "192.168.1.5 alive.\n " ; } else{ print "no ping from 192.168.1.5\n"; } $p->close();