line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::Async::Ping; |
2
|
|
|
|
|
|
|
$Net::Async::Ping::VERSION = '0.001001'; |
3
|
1
|
|
|
1
|
|
16628
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
27
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: asyncronously check remote host for reachability |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
482
|
use Module::Runtime 'use_module'; |
|
1
|
|
|
|
|
1385
|
|
|
1
|
|
|
|
|
7
|
|
9
|
1
|
|
|
1
|
|
538
|
use namespace::clean; |
|
1
|
|
|
|
|
10572
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
my %method_map = ( |
12
|
|
|
|
|
|
|
tcp => 'TCP', |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
1
|
|
|
1
|
1
|
13
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
50
|
|
|
4
|
my $method = shift || 'tcp'; |
19
|
|
|
|
|
|
|
|
20
|
1
|
50
|
|
|
|
7
|
die "The '$method' proto of Net::Ping not ported yet" |
21
|
|
|
|
|
|
|
unless $method_map{$method}; |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
|
|
2
|
my @args; |
24
|
1
|
50
|
|
|
|
4
|
if (ref $_[0]) { |
25
|
0
|
|
|
|
|
0
|
@args = ($_[0]) |
26
|
|
|
|
|
|
|
} else { |
27
|
1
|
|
|
|
|
3
|
my ($default_timeout, $bytes, $device, $tos, $ttl) = @_; |
28
|
|
|
|
|
|
|
|
29
|
1
|
50
|
|
|
|
12
|
@args = ( |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
30
|
|
|
|
|
|
|
(@_ >= 1 ? (default_timeout => $default_timeout) : ()), |
31
|
|
|
|
|
|
|
(@_ >= 2 ? (bytes => $bytes) : ()), |
32
|
|
|
|
|
|
|
(@_ >= 3 ? (device => $device) : ()), |
33
|
|
|
|
|
|
|
(@_ >= 4 ? (tos => $tos) : ()), |
34
|
|
|
|
|
|
|
(@_ >= 5 ? (ttl => $ttl) : ()), |
35
|
|
|
|
|
|
|
) |
36
|
|
|
|
|
|
|
} |
37
|
1
|
|
|
|
|
10
|
use_module('Net::Async::Ping::' . $method_map{$method})->new(@args) |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |