line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2330
|
use strict; use warnings; |
|
2
|
|
|
2
|
|
10
|
|
|
2
|
|
|
|
|
308
|
|
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
161
|
|
2
|
|
|
|
|
|
|
package JS; |
3
|
|
|
|
|
|
|
our $VERSION = '0.29'; |
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
21
|
use File::Find; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
2132
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new { |
8
|
4
|
|
|
4
|
0
|
6
|
my $class = shift; |
9
|
4
|
|
|
|
|
16
|
return bless {@_}, $class; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub run { |
13
|
4
|
|
|
4
|
0
|
8
|
my $self = shift; |
14
|
4
|
|
|
|
|
6
|
my @args = @_; |
15
|
|
|
|
|
|
|
|
16
|
4
|
50
|
|
|
|
11
|
if (! @args) { |
17
|
0
|
|
|
|
|
0
|
return $self->list_all(); |
18
|
|
|
|
|
|
|
} |
19
|
4
|
|
|
|
|
7
|
for my $js_module (@args) { |
20
|
4
|
|
|
|
|
10
|
$js_module =~ s/\.js$//; |
21
|
4
|
50
|
|
|
|
11
|
my @path = $self->find_js_path($js_module) |
22
|
|
|
|
|
|
|
or warn("*** Can't find $js_module\n"), next; |
23
|
4
|
|
|
|
|
45
|
print join "\n", sort(@path), ""; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub list_all { |
28
|
0
|
|
|
0
|
0
|
0
|
my $found = {}; |
29
|
|
|
|
|
|
|
find { |
30
|
|
|
|
|
|
|
wanted => sub { |
31
|
0
|
0
|
|
0
|
|
0
|
return unless -f $_; |
32
|
0
|
0
|
|
|
|
0
|
return if /\.(?:pm|pod|packlist)$/; |
33
|
0
|
0
|
|
|
|
0
|
return if /^\./; |
34
|
0
|
|
|
|
|
0
|
my $dir = $File::Find::dir; |
35
|
0
|
0
|
|
|
|
0
|
$dir =~ s{.*/JS\b(/|$)(.*)}{$2} or return; |
36
|
0
|
0
|
|
|
|
0
|
my $module = $dir ? "$dir/$_" : $_; |
37
|
0
|
0
|
|
|
|
0
|
if ($module =~ s/\.js$//) { |
38
|
0
|
|
|
|
|
0
|
$module =~ s/[\/\\]+/./g; |
39
|
|
|
|
|
|
|
} |
40
|
0
|
0
|
|
|
|
0
|
return if $found->{$module}++; |
41
|
0
|
|
|
|
|
0
|
print $module, "\n"; |
42
|
|
|
|
|
|
|
}, |
43
|
0
|
0
|
|
|
|
0
|
}, grep {-d $_ and $_ ne '.'} @INC; |
|
0
|
|
|
|
|
0
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub find_js_path { |
47
|
4
|
|
|
4
|
0
|
4
|
my $self = shift; |
48
|
4
|
|
|
|
|
6
|
my $module = shift; |
49
|
4
|
50
|
|
|
|
11
|
unless ($module =~ /\//) { |
50
|
4
|
|
|
|
|
8
|
$module =~ s/(?:\.)/\//g; |
51
|
|
|
|
|
|
|
} |
52
|
4
|
|
|
|
|
9
|
$module =~ s/(?:::)/\//g; |
53
|
4
|
|
|
|
|
17
|
$module =~ s/\*$/.*/; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
6
|
my $found = {}; |
56
|
4
|
|
|
|
|
5
|
my @module_path; |
57
|
|
|
|
|
|
|
find { |
58
|
|
|
|
|
|
|
wanted => sub { |
59
|
56
|
|
|
56
|
|
63
|
my $path = $File::Find::name; |
60
|
56
|
|
|
|
|
52
|
while (1) { |
61
|
56
|
100
|
|
|
|
1517
|
return if -d $_; |
62
|
40
|
100
|
|
|
|
318
|
return if $path =~ /[\\\/]$module\.pm$/i; |
63
|
36
|
100
|
|
|
|
246
|
return if $path =~ /[\\\/]$module\.pod$/i; |
64
|
32
|
100
|
|
|
|
151
|
last if $path =~ /[\\\/]$module$/i; |
65
|
26
|
100
|
|
|
|
154
|
last if $path =~ /[\\\/]$module\.js(?:\.gz)?$/i; |
66
|
22
|
|
|
|
|
393
|
return; |
67
|
|
|
|
|
|
|
} |
68
|
10
|
50
|
|
|
|
37
|
return if $found->{$path}++; |
69
|
10
|
|
|
|
|
128
|
push @module_path, $path; |
70
|
|
|
|
|
|
|
}, |
71
|
4
|
50
|
|
|
|
26
|
}, grep {-d $_ and $_ ne '.'} @INC; |
|
4
|
|
|
|
|
418
|
|
72
|
4
|
|
|
|
|
43
|
return @module_path; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |