line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::PrereqScanner::NotQuiteLite::Parser::ClassAutouse; |
2
|
|
|
|
|
|
|
|
3
|
82
|
|
|
82
|
|
1084
|
use strict; |
|
82
|
|
|
|
|
157
|
|
|
82
|
|
|
|
|
1778
|
|
4
|
82
|
|
|
82
|
|
316
|
use warnings; |
|
82
|
|
|
|
|
139
|
|
|
82
|
|
|
|
|
1497
|
|
5
|
82
|
|
|
82
|
|
360
|
use Perl::PrereqScanner::NotQuiteLite::Util; |
|
82
|
|
|
|
|
148
|
|
|
82
|
|
|
|
|
25518
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub register { return { |
8
|
81
|
|
|
81
|
0
|
377
|
use => { |
9
|
|
|
|
|
|
|
'Class::Autouse' => 'parse_class_autouse_args', |
10
|
|
|
|
|
|
|
}, |
11
|
|
|
|
|
|
|
}} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub parse_class_autouse_args { |
14
|
2
|
|
|
2
|
0
|
7
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
6
|
my $tokens = convert_string_tokens($raw_tokens); |
17
|
2
|
50
|
|
|
|
7
|
if (is_version($tokens->[0])) { |
18
|
0
|
|
|
|
|
0
|
$c->add($used_module => shift @$tokens); |
19
|
|
|
|
|
|
|
} |
20
|
2
|
|
|
|
|
7
|
while(my $token = shift @$tokens) { |
21
|
3
|
|
|
|
|
72
|
my $module = $token; |
22
|
3
|
100
|
|
|
|
8
|
if (ref $module) { |
23
|
2
|
|
|
|
|
17
|
$module = $module->[0]; |
24
|
|
|
|
|
|
|
} |
25
|
3
|
100
|
|
|
|
7
|
if (is_module_name($module)) { |
26
|
1
|
|
|
|
|
6
|
$c->add_recommendation($module => 0); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$c->register_method_parser( |
31
|
2
|
|
|
|
|
10
|
'autouse', |
32
|
|
|
|
|
|
|
[$class, 'parse_autouse_method_args', $used_module], |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub parse_autouse_method_args { |
37
|
1
|
|
|
1
|
0
|
3
|
my ($class, $c, $used_module, $raw_tokens) = @_; |
38
|
1
|
|
|
|
|
3
|
my $tokens = convert_string_tokens($raw_tokens); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
# Check class |
41
|
1
|
|
|
|
|
3
|
my ($klass, $arrow, $method, @args) = @$tokens; |
42
|
1
|
50
|
33
|
|
|
8
|
return unless $klass and ref $klass and $klass->[0] eq $used_module; |
|
|
|
33
|
|
|
|
|
43
|
1
|
50
|
33
|
|
|
8
|
return unless $method and ref $method and $method->[0] eq 'autouse'; |
|
|
|
33
|
|
|
|
|
44
|
1
|
|
|
|
|
8
|
for my $arg (@args) { |
45
|
2
|
100
|
|
|
|
45
|
next if ref $arg; |
46
|
1
|
|
|
|
|
5
|
$c->add_recommendation($arg => 0); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |