Ping.pm

filter: Statementstmt 92.0% 23 / 25 Branchbran 14.2% 2 / 14 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 66.6% 32 / 48 CC 9 SCAR 28.5
CC
9
Cov
63%
new
24.6
BEGIN
1.0
BEGIN
1.0
CRAP 17.3
« Ping/ICMP.pm ↑ Summary Ping/TCP.pm »
1 package Net::Async::Ping;
2 1 $Net::Async::Ping::VERSION = '0.002000';
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: asyncronously check remote host for reachability
7  
8 1 ▶use Module::Runtime 'use_module';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 my %method_map = (
12 tcp => 'TCP',
13 icmp => 'ICMP',
14 );
15  
16 sub new {
17 3 ▶ my $class = shift;
Subroutine new: called CC=9 SCAR=32.0
Pod documented
18  
19 3 ▶ my $method = shift || 'tcp';
Condition50%1/2
shift() || 'tcp'
l!l
30
MC/DC0%0/1
shift() || 'tcp'
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
20  
21 die "The '$method' proto of Net::Ping not ported yet"
22 3 ▶ unless $method_map{$method};
Branch: 1 branch
BranchTrueFalseTotal
unless $method_map{$method} 0 3 3
23  
24 3 my @args;
25 3 ▶ if (ref $_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0]) { } 3 0 3
26 3 @args = (%{$_[0]})
27 } else {
28 0 my ($default_timeout, $bytes, $device, $tos, $ttl) = @_;
29  
30 0 ▶ @args = (
Branch: 5 branches
BranchTrueFalseTotal
@_ >= 1 ? : 0 0 0
@_ >= 2 ? : 0 0 0
@_ >= 3 ? : 0 0 0
@_ >= 4 ? : 0 0 0
@_ >= 5 ? : 0 0 0
31 (@_ >= 1 ? (default_timeout => $default_timeout) : ()),
32 (@_ >= 2 ? (bytes => $bytes) : ()),
33 (@_ >= 3 ? (device => $device) : ()),
34 (@_ >= 4 ? (tos => $tos) : ()),
35 (@_ >= 5 ? (ttl => $ttl) : ()),
36 )
37 }
38 3 use_module('Net::Async::Ping::' . $method_map{$method})->new(@args)
39 }
40  
41 1 1;
42  
43 __END__
« Ping/ICMP.pm ↑ Summary Ping/TCP.pm »