« lib/Perl/PrereqScanner/NotQuiteLite/Util/Prereqs.pm
↑ Summary
lib/Perl/PrereqScanner/NotQuiteLite/Parser/Catalyst.pm »
| 1 | package Perl::PrereqScanner::NotQuiteLite::Parser::TestRequires; | ||||||||||||||||||||||||||||||||||||||||||
| 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 { return { | ||||||||||||||||||||||||||||||||||||||||||
| 8 | 87 | ▶ | use => { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 'Test::Requires' => 'parse_test_requires_args', | ||||||||||||||||||||||||||||||||||||||||||
| 10 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 11 | }} | ||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | sub parse_test_requires_args { | ||||||||||||||||||||||||||||||||||||||||||
| 14 | 5 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_test_requires_args: called CC=11 SCAR=24.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 5 | $c->register_keyword_parser( | |||||||||||||||||||||||||||||||||||||||||
| 17 | 'test_requires', | ||||||||||||||||||||||||||||||||||||||||||
| 18 | [$class, 'parse_test_requires_function_args', $used_module], | ||||||||||||||||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 5 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||||||||||||||||
| 22 | 5 | ▶ | if (is_version($tokens->[0])) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | $c->add($used_module => shift @$tokens); | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 5 | ▶ | if (ref $tokens->[0] and $tokens->[0][1] and $tokens->[0][1] eq '{}') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
ref $tokens->[0] and $tokens->[0][1] and $tokens->[0][1] eq "{}"
ref $tokens->[0] and $tokens->[0][1]
MC/DC100%3/3
ref $tokens->[0] and $tokens->[0][1] and $tokens->[0][1] eq "{}"
ref $tokens->[0]
$tokens->[0][1]
$tokens->[0][1] eq "{}"
Truth table100%4/4
A and B and C
A= ref $tokens->[0]B= $tokens->[0][1]C= $tokens->[0][1] eq "{}"
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 1 | my $tokens_in_hashref = convert_string_tokens($tokens->[0][0]); | |||||||||||||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | while(my ($key, undef, $value, undef) = splice @$tokens_in_hashref, 0, 4) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 1 | ▶ | next unless is_module_name($key); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | next unless is_version($value); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | $c->add_recommendation($key => $value); | |||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||
| 33 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 34 | 4 | for my $token (@$tokens) { | |||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | ▶ | next if ref $token; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 2 | ▶ | if ($token =~ /^v?5/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $c->add_recommendation(perl => $token); | |||||||||||||||||||||||||||||||||||||||||
| 38 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 2 | $c->add_recommendation($token => 0); | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | sub parse_test_requires_function_args { | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 1 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_test_requires_function_args: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 1 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||||||||||||||||
| 49 | 1 | $c->add_recommendation($_ => 0) for grep {!ref $_} @$tokens; | |||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 88 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | __END__ | ||||||||||||||||||||||||||||||||||||||||||