AnyEvent::Ping - ping hosts with AnyEvent
use AnyEvent; use AnyEvent::Ping; my $c = AnyEvent->condvar; my $ping = AnyEvent::Ping->new; $ping->ping('google.com', 1, sub { my $result = shift; print "Result: ", $result->[0][0], " in ", $result->[0][1], " seconds\n"; $c->send; }); $c->recv;
AnyEvent::Ping is an asynchronous AnyEvent pinger.
AnyEvent::Ping implements the following attributes.
interval
my $interval = $ping->interval; $ping->interval(1);
Interval between pings, defaults to 0.2 seconds.
timeout
my $timeout = $ping->timeout; $ping->timeout(3);
Maximum response time, defaults to 5 seconds.
error
my $error = $ping->error;
Last error message.
AnyEvent::Ping implements the following methods.
ping
$ping->ping($ip, $n => sub { my $result = shift; });
Perform a ping of a given $ip address $n times.
AnyEvent, AnyEvent::FastPing
Sergey Zasenko, undef@cpan.org.
undef@cpan.org
Copyright (C) 2012, Sergey Zasenko
This program is free software, you can redistribute it and/or modify it under the same terms as Perl 5.12.
To install AnyEvent::Ping, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::Ping
CPAN shell
perl -MCPAN -e shell install AnyEvent::Ping
For more information on module installation, please visit the detailed CPAN module installation guide.