| 1 | package Tangerine::hook::list; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 16 | $Tangerine::hook::list::VERSION = '0.23'; | |||||||||||||||||||||||||||||||||||||||||
| 3 | 16 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 16 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 16 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 16 | ▶ | use parent 'Tangerine::Hook'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 16 | ▶ | use Tangerine::HookData; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 16 | ▶ | use Tangerine::Occurence; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 16 | ▶ | use Tangerine::Utils qw(any stripquotelike $vre); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 142 | ▶ | sub run { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run: called CC=20 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 142 | my ($self, $s) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 13 | 142 | ▶ | if ((any { $s->[0] eq $_ } qw(use no)) && scalar(@$s) > 2 && | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition100%6/6
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2 and &any(sub {
$s->[1] eq $_;
}
, "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2
MC/DC100%3/3
&any(sub {
$s->[0] eq $_;
}
, "use", "no") and scalar @$s > 2 and &any(sub {
$s->[1] eq $_;
}
, "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
&any(sub {
$s->[0] eq $_;
}
, "use", "no")
scalar @$s > 2
&any(sub {
$s->[1] eq $_;
}
, "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
Truth table100%4/4
A and B and C
A= &any(sub {
$s->[0] eq $_;
}
, "use", "no")B= scalar @$s > 2C= &any(sub {
$s->[1] eq $_;
}
, "aliased", "base", "mixin", "mixin::with", "Mojo::Base", "ok", "parent", "superclass", "Test::Class::Most")
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 657 | ▶ | (any { $s->[1] eq $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | qw(aliased base mixin mixin::with Mojo::Base ok parent superclass | ||||||||||||||||||||||||||||||||||||||||||
| 16 | Test::Class::Most))) { | ||||||||||||||||||||||||||||||||||||||||||
| 17 | 17 | my ($version) = $s->[2] =~ $vre; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 17 | ▶ | $version //= ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$version //= ""
MC/DC0%0/1
$version //= ""
$version
Truth table50%1/2
A
A= $version
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 17 | ▶ | my $voffset = $version ? 3 : 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 17 | my @args; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 17 | ▶ | if (scalar(@$s) > $voffset) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 17 | ▶ | return if $s->[$voffset] eq ';'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 16 | @args = @$s; | |||||||||||||||||||||||||||||||||||||||||
| 24 | 16 | @args = @args[($voffset) .. $#args]; | |||||||||||||||||||||||||||||||||||||||||
| 25 | 16 | @args = stripquotelike(@args); | |||||||||||||||||||||||||||||||||||||||||
| 26 | 10 | @args = grep { !/^-norequire$/ } @args | |||||||||||||||||||||||||||||||||||||||||
| 27 | 16 | ▶ | if any { $s->[1] eq $_ } qw/parent superclass/; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | 16 | ▶ | @args = grep { !/^-(base|strict)$/ } @args | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | if $s->[1] eq 'Mojo::Base'; | ||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | @args = $args[0] | ||||||||||||||||||||||||||||||||||||||||||
| 32 | 59 | ▶ | if $args[0] && any { $s->[1] eq $_ } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 16 | ▶ | qw/aliased mixin mixin::with Mojo::Base ok/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$args[0] and &any(sub {
$s->[1] eq $_;
}
, "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
MC/DC100%2/2
$args[0] and &any(sub {
$s->[1] eq $_;
}
, "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
$args[0]
&any(sub {
$s->[1] eq $_;
}
, "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
Truth table100%3/3
A and B
A= $args[0]B= &any(sub {
$s->[1] eq $_;
}
, "aliased", "mixin", "mixin::with", "Mojo::Base", "ok")
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 16 | ▶ | if ($s->[1] eq 'Test::Class::Most') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | my $tcmparent; | |||||||||||||||||||||||||||||||||||||||||
| 36 | my @results; | ||||||||||||||||||||||||||||||||||||||||||
| 37 | 2 | for my $arg (@args) { | |||||||||||||||||||||||||||||||||||||||||
| 38 | 13 | ▶ | if ($tcmparent) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 5 | ▶ | if (any { $arg eq $_ } qw/attributes is_abstract/) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | undef $tcmparent; | |||||||||||||||||||||||||||||||||||||||||
| 41 | next | ||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | } | |||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | push @results, $arg | |||||||||||||||||||||||||||||||||||||||||
| 44 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 45 | 8 | ▶ | if ($arg eq 'parent') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 3 | $tcmparent++; | |||||||||||||||||||||||||||||||||||||||||
| 47 | undef @results | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 3 | } | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | @args = @results | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 2 | } | |||||||||||||||||||||||||||||||||||||||||
| 53 | 16 | my %found; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 16 | ▶ | for (my $i = 0; $i < scalar(@args); $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 18 | $found{$args[$i]} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 18 | ▶ | if ($args[$i+1] && $args[$i+1] =~ /^v?\d+(?:\.\d+)*$/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$args[$i + 1] and $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
MC/DC100%2/2
$args[$i + 1] and $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
$args[$i + 1]
$args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
Truth table100%3/3
A and B
A= $args[$i + 1]B= $args[$i + 1] =~ /^v?\d+(?:\.\d+)*$/
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 1 | $found{$args[$i]} = $args[$i+1]; | |||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | $i++ | |||||||||||||||||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | return Tangerine::HookData->new( | ||||||||||||||||||||||||||||||||||||||||||
| 62 | modules => { | ||||||||||||||||||||||||||||||||||||||||||
| 63 | map { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 16 | ( $_ => Tangerine::Occurence->new(version => $found{$_}) ) | |||||||||||||||||||||||||||||||||||||||||
| 65 | } keys %found, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 67 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | 125 | return; | |||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | 16 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | __END__ | ||||||||||||||||||||||||||||||||||||||||||