« lib/Perl/PrereqScanner/NotQuiteLite/Parser/ModuleRuntime.pm
↑ Summary
lib/Perl/PrereqScanner/NotQuiteLite/Parser/UniversalVersion.pm »
| 1 | package Perl::PrereqScanner::NotQuiteLite::Parser::Plack; | ||||||||||||||||||||||||||||
| 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 | 'Plack::Builder' => 'parse_plack_builder_args', | ||||||||||||||||||||||||||||
| 10 | }, | ||||||||||||||||||||||||||||
| 11 | }} | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | sub parse_plack_builder_args { | ||||||||||||||||||||||||||||
| 14 | 9 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_plack_builder_args: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # TODO: support add_middleware(_if) methods? | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 9 | $c->register_keyword_parser( | |||||||||||||||||||||||||||
| 19 | 'enable', | ||||||||||||||||||||||||||||
| 20 | [$class, 'parse_enable_args', $used_module], | ||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||
| 22 | 9 | $c->register_keyword_parser( | |||||||||||||||||||||||||||
| 23 | 'enable_if', | ||||||||||||||||||||||||||||
| 24 | [$class, 'parse_enable_if_args', $used_module], | ||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | sub parse_enable_args { | ||||||||||||||||||||||||||||
| 29 | 3 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_enable_args: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 3 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||
| 32 | 3 | shift @$tokens; # discard 'enable' itself | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 3 | ▶ | my $module = shift @$tokens or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 3 | ▶ | if ($module =~ s/^\+//) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | 1 | $c->add($module => 0); | |||||||||||||||||||||||||||
| 37 | } else { | ||||||||||||||||||||||||||||
| 38 | 2 | $module =~ s/^Plack::Middleware:://; | |||||||||||||||||||||||||||
| 39 | 2 | $c->add("Plack::Middleware::".$module => 0); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | sub parse_enable_if_args { | ||||||||||||||||||||||||||||
| 44 | 6 | ▶ | my ($class, $c, $used_module, $raw_tokens) = @_; | ||||||||||||||||||||||||||
|
Subroutine
parse_enable_if_args: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | 6 | ▶ | while(my $token = shift @$raw_tokens) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 15 | ▶ | last if $token->[1] eq 'COMMA' or ref $token->[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$token->[1] eq "COMMA" or ref $token->[0]
MC/DC50%1/2
$token->[1] eq "COMMA" or ref $token->[0]
$token->[1] eq "COMMA"
ref $token->[0]
Truth table66%2/3
A or B
A= $token->[1] eq "COMMA"B= ref $token->[0]
| |||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 6 | ▶ | shift @$raw_tokens if $raw_tokens->[0][1] eq 'COMMA'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 6 | my $tokens = convert_string_tokens($raw_tokens); | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 6 | ▶ | my $module = shift @$tokens or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 6 | ▶ | if ($module =~ s/^\+//) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | 2 | $c->add($module => 0); | |||||||||||||||||||||||||||
| 56 | } else { | ||||||||||||||||||||||||||||
| 57 | 4 | $module =~ s/^Plack::Middleware:://; | |||||||||||||||||||||||||||
| 58 | 4 | $c->add("Plack::Middleware::".$module => 0); | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 88 | 1; | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | __END__ | ||||||||||||||||||||||||||||