« lib/Perl/PrereqScanner/NotQuiteLite/Parser/Unless.pm
↑ Summary
lib/Perl/PrereqScanner/NotQuiteLite/Parser/Plack.pm »
| 1 | package Perl::PrereqScanner::NotQuiteLite::Parser::ModuleRuntime; | ||||||||||||||||||||||||||||
| 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 | 88 | my %known_functions = map {$_ => 1} qw/ | |||||||||||||||||||||||||||
| 8 | require_module use_module use_package_optimistically | ||||||||||||||||||||||||||||
| 9 | /; | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub register { return { | ||||||||||||||||||||||||||||
| 12 | 87 | ▶ | use => { | ||||||||||||||||||||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 'Module::Runtime' => 'parse_module_runtime_args', | ||||||||||||||||||||||||||||
| 14 | }, | ||||||||||||||||||||||||||||
| 15 | }} | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | sub register_fqfn { return { | ||||||||||||||||||||||||||||
| 18 | 743 | ▶ | map { "Module::Runtime::".$_ => "parse_".$_."_args" } | ||||||||||||||||||||||||||
|
Subroutine
register_fqfn: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 19 | keys %known_functions | ||||||||||||||||||||||||||||
| 20 | }} | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub parse_module_runtime_args { | ||||||||||||||||||||||||||||
| 23 | 9 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_module_runtime_args: called CC=5 SCAR=16.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 9 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||
| 26 | 9 | ▶ | if (is_version($tokens->[0])) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | 0 | $c->add($used_module => shift @$tokens); | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 9 | for my $token (@$tokens) { | |||||||||||||||||||||||||||
| 31 | 17 | ▶ | next if ref $token; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 8 | ▶ | if ($known_functions{$token}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 8 | $c->register_keyword_parser( | |||||||||||||||||||||||||||
| 35 | $token, | ||||||||||||||||||||||||||||
| 36 | [$class, 'parse_'.$token.'_args', $used_module], | ||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | sub parse_require_module_args { | ||||||||||||||||||||||||||||
| 43 | 1 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_require_module_args: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 1 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||
| 46 | 1 | shift @$tokens; # function | |||||||||||||||||||||||||||
| 47 | 1 | my $module = shift @$tokens; | |||||||||||||||||||||||||||
| 48 | 1 | ▶ | return unless is_module_name($module); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | 1 | $c->add_conditional($module => 0); | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | sub parse_use_module_args { | ||||||||||||||||||||||||||||
| 53 | 6 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_use_module_args: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 6 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||
| 56 | 6 | shift @$tokens; # function | |||||||||||||||||||||||||||
| 57 | 6 | my ($module, undef, $version) = @$tokens; | |||||||||||||||||||||||||||
| 58 | 6 | ▶ | $version = 0 unless $version and is_version($version); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$version and is_version($version)
MC/DC50%1/2
$version and is_version($version)
$version
is_version($version)
Truth table66%2/3
A and B
A= $versionB= is_version($version)
| |||||||||||||||||||||||||||||
| 59 | 6 | $c->add_conditional($module => $version); | |||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | sub parse_use_package_optimistically_args { | ||||||||||||||||||||||||||||
| 63 | 2 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_use_package_optimistically_args: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 2 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||
| 66 | 2 | shift @$tokens; # function | |||||||||||||||||||||||||||
| 67 | 2 | my ($module, undef, $version) = @$tokens; | |||||||||||||||||||||||||||
| 68 | 2 | ▶ | $version = 0 unless $version and is_version($version); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$version and is_version($version)
MC/DC50%1/2
$version and is_version($version)
$version
is_version($version)
Truth table66%2/3
A and B
A= $versionB= is_version($version)
| |||||||||||||||||||||||||||||
| 69 | 2 | $c->add_conditional($module => $version); | |||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 88 | 1; | |||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | __END__ | ||||||||||||||||||||||||||||