Here are the basics of Net::Ping (Pieces extracted from old code):
# Assumes $host is set to what you want to ping
my $p = Net::Ping->new("icmp",$TimeOut,,,$ttl);
$p->hires(1);#use Time::HiRes module, allowing milliseconds to be
+returned by subsequent calls to ping().
my ($ret, $duration, $ip) = $p->ping($host);
if ($ret){
$verbose and printf("$host [ip: $ip] is alive (%.2f ms)\n"
+, 1000 * $duration);
}
$p->close();
What is the sound of Perl? Is it not the sound of a wall that people have stopped banging their heads against?
-Larry Wall, 1992
|