script/ping.pl untested

filter: Statementstmt 0.0% 0 / 21 Branchbran n/a Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 2 Podpod n/a totaltotal 0.0% 0 / 32 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/usr/bin/env perl
2 use AnyEvent;
3 use AnyEvent::Ping;
4  
5 my $host = shift || '4.2.2.2';
6 my $times = shift || 4;
7 my $package_s = shift || 56;
8 my $c = AnyEvent->condvar;
9  
10 my $ping = AnyEvent::Ping->new;
11  
12 print "PING $host $package_s(@{[$package_s+8]}) bytes of data\n";
13 $ping->ping($host, $times, sub {
14 my $results = shift;
15 foreach my $result (@$results) {
16 my $status = $result->[0];
17 my $time = $result->[1];
18 printf "%s from %s: time=%f ms\n",
19 $status, $host, $time * 1000;
20 };
21 $c->send;
22 });
23  
24 $c->recv;
25 $ping->end;