| 1 | package Tangerine::hook::moduleruntime; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 15 | $Tangerine::hook::moduleruntime::VERSION = '0.22'; | |||||||||||||||||||||||||||||||||||||||||
| 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 Tangerine::HookData; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use Tangerine::Occurence; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 15 | ▶ | use Tangerine::Utils qw(any none stripquotelike); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | sub run { | ||||||||||||||||||||||||||||||||||||||||||
| 12 | 137 | ▶ | my ($self, $s) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=10 SCAR=23.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 137 | my @routines = qw(require_module use_module use_package_optimistically); | |||||||||||||||||||||||||||||||||||||||||
| 14 | 137 | ▶ | if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 1 && | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition83%5/6
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 1 and $s->[1] eq "Module::Runtime"
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 1
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"
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | $s->[1] eq 'Module::Runtime') { | ||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | return Tangerine::HookData->new( hooks => [ | |||||||||||||||||||||||||||||||||||||||||
| 17 | Tangerine::hook::moduleruntime->new(type => 'runtime') ] ); | ||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||
| 19 | # NOTE: For the sake of simplicity, we only check for one subroutine | ||||||||||||||||||||||||||||||||||||||||||
| 20 | # call per statement. | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 135 | ▶ | if ($self->type eq 'runtime' && any { my $f = $_; any { $_ eq $f } @$s } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition66%2/3
$self->type eq "runtime" and &any(sub {
my $f = $_;
&any(sub {
$_ eq $f;
}
, @$s);
}
, @routines)
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)
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | @routines) { | ||||||||||||||||||||||||||||||||||||||||||
| 23 | 3 | ▶ | while (none { $s->[0] eq $_ } @routines) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 3 | shift @$s; | |||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | ▶ | for (my $clip = 0; $clip <= $#$s && $clip < 3; $clip++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$clip <= $s->$#* and $clip < 3
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
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 9 | ▶ | if (any { $s->[$clip] eq $_ } qw(-> ;)) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 3 | @$s = @$s[0..$clip-1]; | |||||||||||||||||||||||||||||||||||||||||
| 29 | last | ||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | } | |||||||||||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | my @args = stripquotelike(@$s[1..$#$s]); | |||||||||||||||||||||||||||||||||||||||||
| 33 | 3 | return Tangerine::HookData->new( | |||||||||||||||||||||||||||||||||||||||||
| 34 | modules => { | ||||||||||||||||||||||||||||||||||||||||||
| 35 | $args[0] => Tangerine::Occurence->new( | ||||||||||||||||||||||||||||||||||||||||||
| 36 | version => $args[1] | ||||||||||||||||||||||||||||||||||||||||||
| 37 | ), | ||||||||||||||||||||||||||||||||||||||||||
| 38 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 39 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 15 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||||||||||||||||