line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::Plack; |
2
|
|
|
|
|
|
|
|
3
|
83
|
|
|
83
|
|
1370
|
use strict; |
|
83
|
|
|
|
|
179
|
|
|
83
|
|
|
|
|
2417
|
|
4
|
83
|
|
|
83
|
|
470
|
use warnings; |
|
83
|
|
|
|
|
254
|
|
|
83
|
|
|
|
|
1957
|
|
5
|
83
|
|
|
83
|
|
492
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
83
|
|
|
|
|
218
|
|
|
83
|
|
|
|
|
38653
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub register { return { |
8
|
82
|
|
|
82
|
0
|
497
|
use => { |
9
|
|
|
|
|
|
|
'Plack::Builder' => 'parse_plack_builder_args', |
10
|
|
|
|
|
|
|
}, |
11
|
|
|
|
|
|
|
}} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub parse_plack_builder_args { |
14
|
9
|
|
|
9
|
0
|
26
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# TODO: support add_middleware(_if) methods? |
17
|
|
|
|
|
|
|
|
18
|
9
|
|
|
|
|
41
|
$c->register_keyword_parser( |
19
|
|
|
|
|
|
|
'enable', |
20
|
|
|
|
|
|
|
[$class, 'parse_enable_args', $used_module], |
21
|
|
|
|
|
|
|
); |
22
|
9
|
|
|
|
|
42
|
$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
|
|
|
3
|
0
|
7
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
12
|
my $tokens = convert_string_tokens($raw_tokens); |
32
|
3
|
|
|
|
|
6
|
shift @$tokens; # discard 'enable' itself |
33
|
|
|
|
|
|
|
|
34
|
3
|
50
|
|
|
|
10
|
my $module = shift @$tokens or return; |
35
|
3
|
100
|
|
|
|
17
|
if ($module =~ s/^\+//) { |
36
|
1
|
|
|
|
|
5
|
$c->add($module => 0); |
37
|
|
|
|
|
|
|
} else { |
38
|
2
|
|
|
|
|
7
|
$module =~ s/^Plack::Middleware:://; |
39
|
2
|
|
|
|
|
11
|
$c->add("Plack::Middleware::".$module => 0); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub parse_enable_if_args { |
44
|
6
|
|
|
6
|
0
|
18
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
45
|
|
|
|
|
|
|
|
46
|
6
|
|
|
|
|
20
|
while(my $token = shift @$raw_tokens) { |
47
|
15
|
100
|
66
|
|
|
71
|
last if $token->[1] eq 'COMMA' or ref $token->[0]; |
48
|
|
|
|
|
|
|
} |
49
|
6
|
100
|
|
|
|
47
|
shift @$raw_tokens if $raw_tokens->[0][1] eq 'COMMA'; |
50
|
|
|
|
|
|
|
|
51
|
6
|
|
|
|
|
25
|
my $tokens = convert_string_tokens($raw_tokens); |
52
|
|
|
|
|
|
|
|
53
|
6
|
50
|
|
|
|
20
|
my $module = shift @$tokens or return; |
54
|
6
|
100
|
|
|
|
23
|
if ($module =~ s/^\+//) { |
55
|
2
|
|
|
|
|
8
|
$c->add($module => 0); |
56
|
|
|
|
|
|
|
} else { |
57
|
4
|
|
|
|
|
16
|
$module =~ s/^Plack::Middleware:://; |
58
|
4
|
|
|
|
|
17
|
$c->add("Plack::Middleware::".$module => 0); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__ |