Tangerine/hook/moduleruntime.pm

filter: Statementstmt 100% 44 / 44 Branchbran 90.0% 9 / 10 Conditioncond 66.6% 8 / 12 MC/DCmcdc 42.8% 3 / 7 Subroutinesub 100% 13 / 13 Podpod 100% 1 / 1 totaltotal 89.6% 78 / 87 CC 10 SCAR 16.1
CC
10
Cov
92%
run
10.2
__ANON__
1.0
__ANON__
1.0
CRAP 5.0
« Tangerine/hook/inline.pm ↑ Summary Tangerine/hook/xxx.pm »
1 package Tangerine::hook::moduleruntime;
2 15 $Tangerine::hook::moduleruntime::VERSION = '0.21';
3 15 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 15 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 15 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 15 ▶use parent 'Tangerine::Hook';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 15 ▶use List::Util 1.33 qw(any none);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 15 ▶use Tangerine::HookData;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 15 ▶use Tangerine::Occurence;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 15 ▶use Tangerine::Utils qw(stripquotelike);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub run {
13 136 ▶ my ($self, $s) = @_;
Subroutine run: called CC=10 SCAR=23.2
Pod documented
14 136 my @routines = qw(require_module use_module use_package_optimistically);
15 136 ▶ if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 1 &&
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1 and $s->[1] eq "Module::Runtime") 2 134 136
Condition83%5/6
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1 and $s->[1] eq "Module::Runtime"
!ll&&!rl&&r
58762
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1
!ll&&!rl&&r
58078
MC/DC66%2/3
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 1 and $s->[1] eq "Module::Runtime"
&any(sub { $s->[0] eq $_; } , "use", "no") scalar @$s > 1 $s->[1] eq "Module::Runtime"
Truth table75%3/4
A and B and C
A= &any(sub { $s->[0] eq $_; } , "use", "no")B= scalar @$s > 1C= $s->[1] eq "Module::Runtime"
ABCresult
0XX0
10X0
1100
1111
16 $s->[1] eq 'Module::Runtime') {
17 2 return Tangerine::HookData->new( hooks => [
18 Tangerine::hook::moduleruntime->new(type => 'runtime') ] );
19 }
20 # NOTE: For the sake of simplicity, we only check for one subroutine
21 # call per statement.
22 134 ▶ if ($self->type eq 'runtime' && any { my $f = $_; any { $_ eq $f } @$s }
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if ($self->type eq "runtime" and &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)) 3 131 134
Condition66%2/3
$self->type eq "runtime" and &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
!ll&&!rl&&r
13103
MC/DC50%1/2
$self->type eq "runtime" and &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
$self->type eq "runtime" &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
Truth table66%2/3
A and B
A= $self->type eq "runtime"B= &any(sub { my $f = $_; &any(sub { $_ eq $f; } , @$s); } , @routines)
ABresult
0X0
100
111
23 @routines) {
24 3 ▶ while (none { $s->[0] eq $_ } @routines) {
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&none(sub { $s->[0] eq $_; } , @routines)) 3 3 6
25 3 shift @$s;
26 }
27 3 ▶ for (my $clip = 0; $clip <= $#$s && $clip < 3; $clip++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($clip <= $s->$#* and $clip < 3) 9 0 9
Condition33%1/3
$clip <= $s->$#* and $clip < 3
!ll&&!rl&&r
009
MC/DC0%0/2
$clip <= $s->$#* and $clip < 3
$clip <= $s->$#* $clip < 3
Truth table33%1/3
A and B
A= $clip <= $s->$#*B= $clip < 3
ABresult
0X0
100
111
28 9 ▶ if (any { $s->[$clip] eq $_ } qw(-> ;)) {
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $s->[$clip] eq $_; } , "->", ";")) 3 6 9
29 3 @$s = @$s[0..$clip-1];
30 last
31 3 }
32 }
33 3 my @args = stripquotelike(@$s[1..$#$s]);
34 3 return Tangerine::HookData->new(
35 modules => {
36 $args[0] => Tangerine::Occurence->new(
37 version => $args[1]
38 ),
39 },
40 );
41 }
42 }
43  
44 15 1;
45  
46 __END__
« Tangerine/hook/inline.pm ↑ Summary Tangerine/hook/xxx.pm »