| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Plient::Util; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
|
5
|
|
|
|
|
9
|
|
|
|
5
|
|
|
|
|
136
|
|
|
4
|
5
|
|
|
5
|
|
24
|
use strict; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
133
|
|
|
5
|
5
|
|
|
5
|
|
22
|
use Carp; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
276
|
|
|
6
|
5
|
|
|
5
|
|
24
|
use Config; |
|
|
5
|
|
|
|
|
11
|
|
|
|
5
|
|
|
|
|
228
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
26
|
use File::Spec::Functions; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
505
|
|
|
9
|
5
|
|
|
5
|
|
28
|
use base 'Exporter'; |
|
|
5
|
|
|
|
|
8
|
|
|
|
5
|
|
|
|
|
627
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = 'which'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
27
|
use constant WIN32 => $^O eq 'MSWin32'; |
|
|
5
|
|
|
|
|
7
|
|
|
|
5
|
|
|
|
|
2170
|
|
|
13
|
|
|
|
|
|
|
my $bin_quote = WIN32 ? q{"} : q{'}; |
|
14
|
|
|
|
|
|
|
my $bin_ext = $Config{_exe}; |
|
15
|
|
|
|
|
|
|
my %cache; |
|
16
|
|
|
|
|
|
|
sub which { |
|
17
|
3
|
|
|
3
|
0
|
8
|
my $name = shift; |
|
18
|
3
|
50
|
|
|
|
15
|
return $cache{$name} if $cache{$name}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
3
|
|
|
|
|
7
|
my $path; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
LINE: |
|
23
|
3
|
|
|
|
|
19
|
for my $dir ( path() ) { |
|
24
|
21
|
|
|
|
|
154
|
my $p = catfile( $dir, $name ); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# XXX any other names need to try? |
|
27
|
21
|
|
|
|
|
49
|
my @try = grep { -x } ( $p, $p . $bin_ext ); |
|
|
42
|
|
|
|
|
642
|
|
|
28
|
21
|
|
|
|
|
52
|
for my $try (@try) { |
|
29
|
0
|
|
|
|
|
0
|
$path = $try; |
|
30
|
0
|
|
|
|
|
0
|
last LINE; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
3
|
50
|
|
|
|
23
|
return unless $path; |
|
35
|
0
|
0
|
0
|
|
|
|
if ( $path =~ /\s/ && $path !~ /^$bin_quote/ ) { |
|
36
|
0
|
|
|
|
|
|
$path = $bin_quote . $path . $bin_quote; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
return $cache{$name} = $path; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |