line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::multiwhich; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
70322
|
use utf8; |
|
2
|
|
|
|
|
59
|
|
|
2
|
|
|
|
|
10
|
|
4
|
2
|
|
|
2
|
|
112
|
use 5.006; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
76
|
|
5
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
26
|
|
|
2
|
|
|
|
|
89
|
|
6
|
2
|
|
|
2
|
|
11
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
153
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
9
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
|
2098
|
use namespace::sweep; |
|
2
|
|
|
|
|
69288
|
|
|
2
|
|
|
|
|
15
|
|
12
|
2
|
|
|
2
|
|
2100
|
use File::Spec::Functions qw( canonpath catfile path ); |
|
2
|
|
|
|
|
1749
|
|
|
2
|
|
|
|
|
180
|
|
13
|
2
|
|
|
2
|
|
12
|
use File::Basename qw( fileparse ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
133
|
|
14
|
2
|
|
|
2
|
|
891
|
use Perl::OSType qw(is_os_type); |
|
2
|
|
|
|
|
481
|
|
|
2
|
|
|
|
|
965
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
1
|
|
|
1
|
1
|
65
|
my $class = shift; |
18
|
1
|
|
|
|
|
2
|
my $self = [ @{ $_[0] } ]; |
|
1
|
|
|
|
|
19
|
|
19
|
0
|
|
|
|
|
|
bless $self => $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub run { |
23
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
24
|
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
@$self or $self->usage; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my @path = path; |
28
|
0
|
|
|
|
|
|
my @pathext = (''); |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
if (is_os_type('Windows')) { |
31
|
0
|
|
|
|
|
|
push @pathext, map lc, |
32
|
|
|
|
|
|
|
map /\A([.][A-Za-z0-9]{1,32})\z/, |
33
|
|
|
|
|
|
|
split /;/, $ENV{PATHEXT} |
34
|
|
|
|
|
|
|
; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
my @ret; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
LOOKFOR: |
40
|
0
|
|
|
|
|
|
for my $lookfor ( @$self ) { |
41
|
0
|
0
|
|
|
|
|
if ($lookfor ne fileparse $lookfor) { |
42
|
0
|
|
|
|
|
|
warn "Skipped '$lookfor': Argument is not a plain file name\n"; |
43
|
0
|
|
|
|
|
|
next LOOKFOR; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
my %results = ( $lookfor => [] ); |
47
|
0
|
|
|
|
|
|
my ($results) = values %results; |
48
|
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
for my $dir ( @path ) { |
50
|
0
|
|
|
|
|
|
for my $ext ( @pathext ) { |
51
|
0
|
|
|
|
|
|
my $p = catfile $dir => "$lookfor$ext"; |
52
|
0
|
0
|
|
|
|
|
if (-x $p) { |
53
|
0
|
|
|
|
|
|
push @$results, canonpath $p; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
push @ret, \%results; |
59
|
|
|
|
|
|
|
} |
60
|
0
|
|
|
|
|
|
return \@ret; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub usage { |
64
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
die "Usage: multiwhich name1 name2 name3 ... namex\n"; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__DATA__ |