Role/Commons/Tap.pm

filter: Statementstmt 80.9% 34 / 42 Branchbran 37.5% 6 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 69.8% 51 / 73 CC 10 SCAR 25.2
CC
10
Cov
67%
tap
21.6
__ANON__
1.0
BEGIN
1.0
CRAP 12.4
« Role/Commons.pm ↑ Summary Role/Commons/Authority.pm »
1 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Role::Commons::Tap;
6  
7 1 ▶use Carp qw[croak];
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶ use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 $Role::Commons::Tap::AUTHORITY = 'cpan:TOBYINK';
12 1 $Role::Commons::Tap::VERSION = '0.104';
13 }
14  
15 1 ▶our $setup_for_class = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
16 1 my ($role, $package, %args) = @_;
17 1 return 0;
18 1 };
19  
20 sub tap
21 1 ▶{
Subroutine tap: called CC=10 SCAR=30.7
Pod documented
22 1 my $self = shift;
23 1 my %flags;
24
25 1 ▶ PARAM: while (@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1 1 2
26 {
27 1 my $next = shift;
28
29 1 ▶ if (ref($next) eq 'CODE' or not ref $next)
Branch: 1 branch
BranchTrueFalseTotal
if (ref $next eq "CODE" or not ref $next) 1 0 1
Condition33%1/3
ref $next eq "CODE" or not ref $next
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $next eq "CODE" or not ref $next
ref $next eq "CODE" not ref $next
Truth table33%1/3
A or not(B)
A= ref $next eq "CODE"B= not ref $next
ABresult
1X1
011
000
30 {
31 1 ▶ my $args = ref($_[0]) eq 'ARRAY' ? shift : [];
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] eq 'ARRAY' ? : 0 1 1
32 1 ▶ my $code = ref $next ? $next : sub { $self->$next(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.2
Branch: 1 branch
BranchTrueFalseTotal
ref $next ? : 0 1 1
33
34 1 ▶ if ($flags{ EVAL })
Branch: 1 branch
BranchTrueFalseTotal
if ($flags{'EVAL'}) { } 0 1 1
35 {
36 0 local $_ = $self;
37 0 eval { $code->(@$args) }
38 }
39 else
40 {
41 1 local $_ = $self;
42 1 do { $code->(@$args) }
43 }
44 1 next PARAM;
45 }
46
47 0 ▶ if (ref($next) eq 'SCALAR')
Branch: 1 branch
BranchTrueFalseTotal
if (ref $next eq "SCALAR") 0 0 0
48 {
49 0 ▶ if ($$next =~ m{^(no_?)?(.+)$}i)
Branch: 1 branch
BranchTrueFalseTotal
if ($$next =~ /^(no_?)?(.+)$/i) 0 0 0
50 {
51 0 ▶ $flags{ uc $2 } = $1 ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$1 ? : 0 0 0
52 0 next PARAM;
53 }
54 }
55
56 0 croak qq/Unsupported parameter to tap: $next/;
57 }
58
59 1 return $self;
60 }
61  
62 1 1;
63  
64 __END__
« Role/Commons.pm ↑ Summary Role/Commons/Authority.pm »