Is it possible to get a callback after every ping?
Currently as I see the sub is only called after all 3 have finished so
the only way I could get
what I wanted was calling ping 3 time as in this code:
use AnyEvent;
use AnyEvent::Ping;
my $c = AnyEvent->condvar;
my $ping = AnyEvent::Ping->new;
my $n = 3;
my $host = shift or die "Usage: $0 hostname\n";
sub process {
my $result = shift;
print "Result: ", $result->[0][0], " in ", $result->[0][1], " seconds\n";
$n--;
if ($n > 0) {
$ping->ping($host, 1, \&process);
} else {
$c->send;
}
}
$ping->ping($host, 1, \&process);
$c->recv;
$ping->end;
Is it possible to get a callback after every ping? Currently as I see the sub is only called after all 3 have finished so the only way I could get what I wanted was calling ping 3 time as in this code:
regards Gabor