line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::Moose; |
2
|
|
|
|
|
|
|
|
3
|
83
|
|
|
83
|
|
1673
|
use strict; |
|
83
|
|
|
|
|
169
|
|
|
83
|
|
|
|
|
2041
|
|
4
|
83
|
|
|
83
|
|
371
|
use warnings; |
|
83
|
|
|
|
|
168
|
|
|
83
|
|
|
|
|
1746
|
|
5
|
83
|
|
|
83
|
|
416
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
83
|
|
|
|
|
173
|
|
|
83
|
|
|
|
|
70040
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# There are so many Moose-like variants |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Like Moose; modules that are not listed here but have Moose |
10
|
|
|
|
|
|
|
# in their name are implicitly treated like these as well |
11
|
|
|
|
|
|
|
my @ExportsExtendsAndWith = qw/ |
12
|
|
|
|
|
|
|
Moose Moo Mouse MooX Moo::Lax Moos |
13
|
|
|
|
|
|
|
MooseX::App MooseX::Singleton MooseX::SingletonMethod |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
HTML::FormHandler::Moose Test::Class::Moose |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
App::GHPT::Wrapper::OurMoose App::wmiirc::Plugin Ark |
18
|
|
|
|
|
|
|
Bot::Backbone::Service Bubblegum::Class CatalystX::Declare |
19
|
|
|
|
|
|
|
Cogwheel CPAN::Testers::Backend::Base Dancer2::Plugin |
20
|
|
|
|
|
|
|
Data::Object::Class DBICx::Modeler::Model Digital::Driver |
21
|
|
|
|
|
|
|
Elastic::Doc Fey::ORM::Table Form::Factory::Processor |
22
|
|
|
|
|
|
|
Jedi::App Momo Moonshine::Magic Moxie Nile::Base |
23
|
|
|
|
|
|
|
Parse::FixedRecord Pcore Reaction::Class Reaction::UI::WidgetClass |
24
|
|
|
|
|
|
|
Squirrel Statocles::Base TAEB::OO Test::Able Test::Roo |
25
|
|
|
|
|
|
|
Web::Simple XML::Rabbit |
26
|
|
|
|
|
|
|
/; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Like Moose::Role; modules that are not listed here but have Role |
29
|
|
|
|
|
|
|
# in their name are implicitly treated like these as well |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my @ExportsWith = qw/ |
32
|
|
|
|
|
|
|
Moose::Role Moo::Role Mouse::Role |
33
|
|
|
|
|
|
|
MooseX::Role::Parameterized |
34
|
|
|
|
|
|
|
Mason::PluginRole Mojo::RoleTiny MooX::Cmd |
35
|
|
|
|
|
|
|
Role::Basic Role::Tiny Role::Tiny::With Reflex::Role |
36
|
|
|
|
|
|
|
Template::Caribou Test::Routine App::SimulateReads::Base |
37
|
|
|
|
|
|
|
/; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Like Mo |
40
|
|
|
|
|
|
|
my @ExportsExtends = qw/ |
41
|
|
|
|
|
|
|
Mo |
42
|
|
|
|
|
|
|
Lingy::Base OptArgs2::Mo Parse::SAMGov::Mo Pegex::Base |
43
|
|
|
|
|
|
|
Sub::Mage TestML::Base Type::Utils VSO |
44
|
|
|
|
|
|
|
/; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub register { |
47
|
82
|
|
|
82
|
0
|
336
|
my ($class, %args) = @_; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Make sure everything is unique |
50
|
82
|
50
|
|
|
|
177
|
my %exports_extends_and_with = map {$_ => 1} (@ExportsExtendsAndWith, @{$args{exports_extends_and_with} || []}); |
|
3444
|
|
|
|
|
6028
|
|
|
82
|
|
|
|
|
525
|
|
51
|
82
|
50
|
|
|
|
268
|
my %exports_extends = map {$_ => 1} (@ExportsExtends, @{$args{exports_extends} || []}); |
|
738
|
|
|
|
|
1368
|
|
|
82
|
|
|
|
|
396
|
|
52
|
82
|
50
|
|
|
|
196
|
my %exports_with = map {$_ => 1} (@ExportsWith, @{$args{exports_with} || []}); |
|
1148
|
|
|
|
|
2063
|
|
|
82
|
|
|
|
|
407
|
|
53
|
|
|
|
|
|
|
|
54
|
82
|
|
|
|
|
361
|
for my $module (keys %exports_with) { |
55
|
1148
|
50
|
|
|
|
3195
|
if (exists $exports_extends_and_with{$module}) { |
56
|
0
|
|
|
|
|
0
|
delete $exports_with{$module}; |
57
|
0
|
|
|
|
|
0
|
next; |
58
|
|
|
|
|
|
|
} |
59
|
1148
|
50
|
|
|
|
1921
|
if (exists $exports_extends{$module}) { |
60
|
0
|
|
|
|
|
0
|
$exports_extends_and_with{$module} = 1; |
61
|
0
|
|
|
|
|
0
|
delete $exports_with{$module}; |
62
|
0
|
|
|
|
|
0
|
next; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
82
|
|
|
|
|
1502
|
for my $module (keys %exports_extends) { |
66
|
738
|
50
|
|
|
|
1432
|
if (exists $exports_extends_and_with{$module}) { |
67
|
0
|
|
|
|
|
0
|
delete $exports_extends{$module}; |
68
|
0
|
|
|
|
|
0
|
next; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
82
|
|
|
|
|
184
|
my %mapping; |
73
|
82
|
|
|
|
|
302
|
for my $module (keys %exports_with) { |
74
|
1148
|
|
|
|
|
1882
|
$mapping{use}{$module} = 'register_with'; |
75
|
1148
|
|
|
|
|
1778
|
$mapping{no}{$module} = 'remove_with'; |
76
|
|
|
|
|
|
|
} |
77
|
82
|
|
|
|
|
275
|
for my $module (keys %exports_extends) { |
78
|
738
|
|
|
|
|
1105
|
$mapping{use}{$module} = 'register_extends'; |
79
|
738
|
|
|
|
|
1181
|
$mapping{no}{$module} = 'remove_extends'; |
80
|
|
|
|
|
|
|
} |
81
|
82
|
|
|
|
|
643
|
for my $module (keys %exports_extends_and_with) { |
82
|
3444
|
|
|
|
|
5021
|
$mapping{use}{$module} = 'register_extends_and_with'; |
83
|
3444
|
|
|
|
|
5245
|
$mapping{no}{$module} = 'remove_extends_and_with'; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
82
|
|
|
|
|
841
|
return \%mapping; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub register_extends_and_with { |
90
|
54
|
|
|
54
|
0
|
158
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
91
|
|
|
|
|
|
|
|
92
|
54
|
|
|
|
|
257
|
$c->register_keyword_parser( |
93
|
|
|
|
|
|
|
'extends', |
94
|
|
|
|
|
|
|
[$class, 'parse_extends_args', $used_module], |
95
|
|
|
|
|
|
|
); |
96
|
54
|
|
|
|
|
176
|
$c->register_keyword_parser( |
97
|
|
|
|
|
|
|
'with', |
98
|
|
|
|
|
|
|
[$class, 'parse_with_args', $used_module], |
99
|
|
|
|
|
|
|
); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub register_with { |
103
|
3
|
|
|
3
|
0
|
9
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
104
|
|
|
|
|
|
|
|
105
|
3
|
|
|
|
|
11
|
$c->register_keyword_parser( |
106
|
|
|
|
|
|
|
'with', |
107
|
|
|
|
|
|
|
[$class, 'parse_with_args', $used_module], |
108
|
|
|
|
|
|
|
); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub register_extends { |
112
|
2
|
|
|
2
|
0
|
7
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
113
|
|
|
|
|
|
|
|
114
|
2
|
|
|
|
|
6
|
$c->register_keyword_parser( |
115
|
|
|
|
|
|
|
'extends', |
116
|
|
|
|
|
|
|
[$class, 'parse_extends_args', $used_module], |
117
|
|
|
|
|
|
|
); |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub remove_extends_and_with { |
121
|
1
|
|
|
1
|
0
|
3
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
122
|
|
|
|
|
|
|
|
123
|
1
|
|
|
|
|
4
|
$c->remove_keyword('extends'); |
124
|
1
|
|
|
|
|
3
|
$c->remove_keyword('with'); |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub remove_with { |
128
|
0
|
|
|
0
|
0
|
0
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
129
|
|
|
|
|
|
|
|
130
|
0
|
|
|
|
|
0
|
$c->remove_keyword('with'); |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub remove_extends { |
134
|
0
|
|
|
0
|
0
|
0
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
135
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
0
|
$c->remove_keyword('extends'); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
27
|
|
|
27
|
0
|
128
|
sub parse_extends_args { shift->_parse_loader_args(@_) } |
140
|
33
|
|
|
33
|
0
|
114
|
sub parse_with_args { shift->_parse_loader_args(@_) } |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub _parse_loader_args { |
143
|
60
|
|
|
60
|
|
152
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
144
|
|
|
|
|
|
|
|
145
|
60
|
|
|
|
|
193
|
my $tokens = convert_string_tokens($raw_tokens); |
146
|
60
|
|
|
|
|
114
|
shift @$tokens; # discard extends, with; |
147
|
|
|
|
|
|
|
|
148
|
60
|
|
|
|
|
91
|
my $prev; |
149
|
60
|
|
|
|
|
148
|
for my $token (@$tokens) { |
150
|
240
|
100
|
|
|
|
469
|
if (!ref $token) { |
151
|
89
|
|
|
|
|
258
|
$c->add($token => 0); |
152
|
89
|
|
|
|
|
2476
|
$prev = $token; |
153
|
89
|
|
|
|
|
184
|
next; |
154
|
|
|
|
|
|
|
} |
155
|
151
|
|
100
|
|
|
325
|
my $desc = $token->[1] || ''; |
156
|
151
|
100
|
|
|
|
454
|
if ($desc eq '{}') { |
157
|
29
|
50
|
|
|
|
39
|
my @hash_tokens = @{$token->[0] || []}; |
|
29
|
|
|
|
|
85
|
|
158
|
29
|
|
|
|
|
89
|
for(my $i = 0, my $len = @hash_tokens; $i < $len; $i++) { |
159
|
104
|
100
|
66
|
|
|
3153
|
if ($hash_tokens[$i][0] eq '-version' and $i < $len - 2) { |
160
|
27
|
|
|
|
|
59
|
my $maybe_version_token = $hash_tokens[$i + 2]; |
161
|
27
|
|
|
|
|
49
|
my $maybe_version = $maybe_version_token->[0]; |
162
|
27
|
100
|
|
|
|
57
|
if (ref $maybe_version) { |
163
|
18
|
|
|
|
|
36
|
$maybe_version = $maybe_version->[0]; |
164
|
|
|
|
|
|
|
} |
165
|
27
|
50
|
33
|
|
|
92
|
if ($prev and is_version($maybe_version)) { |
166
|
27
|
|
|
|
|
75
|
$c->add($prev => $maybe_version); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
} |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
1; |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
__END__ |