lib/Perl/PrereqScanner/NotQuiteLite/Parser/PackageVariant.pm

filter: Statementstmt 95.0% 38 / 40 Branchbran 76.3% 29 / 38 Conditioncond 76.1% 16 / 21 MC/DCmcdc 58.3% 7 / 12 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 80.5% 95 / 118 SCAR 34.0
CC
27
Cov
84%
parse_package_variant_args
31.4
BEGIN
1.0
BEGIN
1.0
CRAP 30.1
« blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/Plack.pm ↑ Summary lib/Perl/PrereqScanner/NotQuiteLite/Parser/Moose.pm »
1 package Perl::PrereqScanner::NotQuiteLite::Parser::PackageVariant;
2  
3 88 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 88 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 88 ▶use Perl::PrereqScanner::NotQuiteLite::Util;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub register {{
8 87 ▶ use => {
Subroutine register: called CC=1 SCAR=0.0
Pod undocumented
9 'Package::Variant' => 'parse_package_variant_args',
10 },
11 }}
12  
13 sub parse_package_variant_args {
14 7 ▶ my ($class, $c, $used_module, $raw_tokens) = @_;
Subroutine parse_package_variant_args: called CC=27 SCAR=34.5
Pod undocumented
15  
16 7 my $tokens = convert_string_tokens($raw_tokens);
17  
18 7 ▶ while(my $token = shift @$tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $token = shift @$tokens) 21 7 28
19 21 ▶ if (ref $token and $token->[0] eq 'importing') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $token and $token->[0] eq 'importing') { } 5 16 21
elsif (ref $token and not ref $token->[0] and $token->[1] eq 'WORD') { } 4 17 21
Condition100%3/3
ref $token and $token->[0] eq "importing"
!ll&&!rl&&r
3135
MC/DC100%2/2
ref $token and $token->[0] eq "importing"
ref $token $token->[0] eq "importing"
Truth table100%3/3
A and B
A= ref $tokenB= $token->[0] eq "importing"
ABresult
0X0
100
111
20 5 ▶ shift @$tokens if @$tokens && $tokens->[0][1] eq 'COMMA';
Branch: 1 branch
BranchTrueFalseTotal
if @$tokens and $tokens->[0][1] eq "COMMA" 5 0 5
Condition33%1/3
@$tokens and $tokens->[0][1] eq "COMMA"
!ll&&!rl&&r
005
MC/DC0%0/2
@$tokens and $tokens->[0][1] eq "COMMA"
@$tokens $tokens->[0][1] eq "COMMA"
Truth table33%1/3
A and B
A= @$tokensB= $tokens->[0][1] eq "COMMA"
ABresult
0X0
100
111
21 5 ▶ my $next_token = shift @$tokens or last;
Branch: 1 branch
BranchTrueFalseTotal
my $next_token = shift @$tokens or last 0 5 5
22 5 ▶ if (!ref $next_token) {
Branch: 3 branches
BranchTrueFalseTotal
if (not ref $next_token) { } 1 4 5
elsif ($next_token->[1] eq '[]') { } 3 1 4
elsif ($next_token->[1] eq '{}') { } 1 0 1
23 1 my $module = $next_token;
24 1 ▶ if (is_module_name($module)) {
Branch: 1 branch
BranchTrueFalseTotal
if (is_module_name($module)) 1 0 1
25 1 $c->add($module);
26 1 ▶ if ($c->has_callback_for(use => $module)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->has_callback_for("use", $module)) 0 1 1
27 0 $c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], [";", ";"]]);
28 }
29 }
30 }
31 elsif ($next_token->[1] eq '[]') {
32 3 my $modules = convert_string_token_list($next_token->[0]);
33 3 ▶ while(my $module = shift @$modules) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $module = shift @$modules) 5 3 8
34 5 ▶ next unless is_module_name($module);
Branch: 1 branch
BranchTrueFalseTotal
unless is_module_name($module) 1 4 5
35 4 $c->add($module);
36 4 ▶ if ($c->has_callback_for(use => $module)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->has_callback_for("use", $module)) 2 2 4
37 2 $c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], [";", ";"]]);
38 }
39 }
40 } elsif ($next_token->[1] eq '{}') {
41 1 my $hash_tokens = convert_string_token_list($next_token->[0]);
42 1 ▶ while(my $module = shift @$hash_tokens) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $module = shift @$hash_tokens) 1 1 2
43 1 my $arg = shift @$hash_tokens;
44 1 ▶ my @args = $arg->[1] eq '[]' ? @{$arg->[0]} : $arg;
Branch: 1 branch
BranchTrueFalseTotal
$arg->[1] eq '[]' ? : 0 1 1
45 1 $c->add($module);
46 1 ▶ if ($c->has_callback_for(use => $module)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c->has_callback_for("use", $module)) 1 0 1
47 1 $c->run_callback_for('use', $module, [["use", "KEYWORD"], [$module, "WORD"], @args, [";", ";"]]);
48 }
49 }
50 }
51 }
52 ▶ elsif (ref $token && !ref $token->[0] && $token->[1] eq 'WORD') {
Condition100%6/6
ref $token and not ref $token->[0] and $token->[1] eq "WORD"
!ll&&!rl&&r
574
ref $token and not ref $token->[0]
!ll&&!rl&&r
3211
MC/DC100%3/3
ref $token and not ref $token->[0] and $token->[1] eq "WORD"
ref $token not ref $token->[0] $token->[1] eq "WORD"
Truth table100%4/4
A and not(B) and C
A= ref $tokenB= not ref $token->[0]C= $token->[1] eq "WORD"
ABCresult
0XX0
10X0
1100
1111
53 4 ▶ shift @$tokens if @$tokens && $tokens->[0][1] eq 'COMMA';
Branch: 1 branch
BranchTrueFalseTotal
if @$tokens and $tokens->[0][1] eq "COMMA" 4 0 4
Condition33%1/3
@$tokens and $tokens->[0][1] eq "COMMA"
!ll&&!rl&&r
004
MC/DC0%0/2
@$tokens and $tokens->[0][1] eq "COMMA"
@$tokens $tokens->[0][1] eq "COMMA"
Truth table33%1/3
A and B
A= @$tokensB= $tokens->[0][1] eq "COMMA"
ABresult
0X0
100
111
54 4 ▶ shift @$tokens if @$tokens;
Branch: 1 branch
BranchTrueFalseTotal
if @$tokens 4 0 4
55 }
56 21 ▶ shift @$tokens if @$tokens && ref $tokens->[0] && $tokens->[0][1] eq 'COMMA';
Branch: 1 branch
BranchTrueFalseTotal
if @$tokens and ref $tokens->[0] and $tokens->[0][1] eq "COMMA" 8 13 21
Condition83%5/6
@$tokens and ref $tokens->[0] and $tokens->[0][1] eq "COMMA"
!ll&&!rl&&r
768
@$tokens and ref $tokens->[0]
!ll&&!rl&&r
7014
MC/DC66%2/3
@$tokens and ref $tokens->[0] and $tokens->[0][1] eq "COMMA"
@$tokens ref $tokens->[0] $tokens->[0][1] eq "COMMA"
Truth table75%3/4
A and B and C
A= @$tokensB= ref $tokens->[0]C= $tokens->[0][1] eq "COMMA"
ABCresult
0XX0
10X0
1100
1111
57 }
58 }
59  
60 88 1;
61  
62 __END__
« blib/lib/Perl/PrereqScanner/NotQuiteLite/Parser/Plack.pm ↑ Summary lib/Perl/PrereqScanner/NotQuiteLite/Parser/Moose.pm »