line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::perlfind::Plugin::UseModule; |
2
|
10
|
|
|
10
|
|
3141862
|
use strict; |
|
10
|
|
|
|
|
32
|
|
|
10
|
|
|
|
|
434
|
|
3
|
10
|
|
|
10
|
|
57
|
use warnings; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
288
|
|
4
|
10
|
|
|
10
|
|
484
|
use App::perlfind; |
|
10
|
|
|
|
|
53
|
|
|
10
|
|
|
|
|
479
|
|
5
|
|
|
|
|
|
|
our $VERSION = '2.07'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
App::perlfind->add_trigger( |
8
|
|
|
|
|
|
|
'matches.add' => sub { |
9
|
|
|
|
|
|
|
my ($class, $word, $matches) = @_; |
10
|
|
|
|
|
|
|
# does it look like a package name? |
11
|
|
|
|
|
|
|
return unless $$word =~ /^\w+(::\w+)*$/; |
12
|
|
|
|
|
|
|
my $try_module = sub { |
13
|
|
|
|
|
|
|
my $module = shift; |
14
|
1
|
|
|
1
|
|
287
|
eval "use $module;"; |
|
0
|
|
|
1
|
|
0
|
|
|
0
|
|
|
1
|
|
0
|
|
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
1
|
|
3
|
|
|
1
|
|
|
1
|
|
27
|
|
|
1
|
|
|
1
|
|
234
|
|
|
0
|
|
|
1
|
|
0
|
|
|
0
|
|
|
1
|
|
0
|
|
|
1
|
|
|
1
|
|
372
|
|
|
0
|
|
|
1
|
|
0
|
|
|
0
|
|
|
1
|
|
0
|
|
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
367
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
290
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
370
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
198
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
176
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
173
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
242
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
199
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
194
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
return 0 if $@; |
16
|
|
|
|
|
|
|
push @$matches, $module; |
17
|
|
|
|
|
|
|
return 1; |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# try it as a module |
21
|
|
|
|
|
|
|
return if $try_module->($$word); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if ($$word =~ /::[A-Z]\w*$/) { |
24
|
|
|
|
|
|
|
push @$matches, $$word; |
25
|
|
|
|
|
|
|
} elsif ($$word =~ s/::\w+$//) { |
26
|
|
|
|
|
|
|
$try_module->($$word); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
__END__ |