Ping.pm

filter: Statementstmt 95.8% 23 / 24 Branchbran 50.0% 7 / 14 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 78.7% 37 / 47 CC 9 SCAR 22.1
CC
9
Cov
78%
new
12.8
BEGIN
1.0
BEGIN
1.0
CRAP 9.2
↑ Summary Ping/TCP.pm »
1 package Net::Async::Ping;
2 1 $Net::Async::Ping::VERSION = '0.001001';
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 );
14  
15 sub new {
16 1 ▶ my $class = shift;
Subroutine new: called CC=9 SCAR=25.5
Pod documented
17  
18 1 ▶ my $method = shift || 'tcp';
Condition50%1/2
shift() || 'tcp'
l!l
10
MC/DC0%0/1
shift() || 'tcp'
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
19  
20 die "The '$method' proto of Net::Ping not ported yet"
21 1 ▶ unless $method_map{$method};
Branch: 1 branch
BranchTrueFalseTotal
unless $method_map{$method} 0 1 1
22  
23 1 my @args;
24 1 ▶ if (ref $_[0]) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0]) { } 0 1 1
25 0 @args = ($_[0])
26 } else {
27 1 my ($default_timeout, $bytes, $device, $tos, $ttl) = @_;
28  
29 1 ▶ @args = (
Branch: 5 branches
BranchTrueFalseTotal
@_ >= 1 ? : 1 0 1
@_ >= 2 ? : 0 1 1
@_ >= 3 ? : 0 1 1
@_ >= 4 ? : 0 1 1
@_ >= 5 ? : 0 1 1
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 use_module('Net::Async::Ping::' . $method_map{$method})->new(@args)
38 }
39  
40 1 1;
41  
42 __END__
↑ Summary Ping/TCP.pm »