line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Puncheur::Plugin::ShareDir; |
2
|
1
|
|
|
1
|
|
529
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
22
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
7
|
1
|
|
|
1
|
|
893
|
use File::ShareDir (); |
|
1
|
|
|
|
|
6526
|
|
|
1
|
|
|
|
|
27
|
|
8
|
1
|
|
|
1
|
|
14
|
use List::Util qw(first); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
339
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT = qw/share_dir/; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub share_dir { |
13
|
2
|
|
|
2
|
0
|
5
|
my $c = shift; |
14
|
2
|
|
66
|
|
|
13
|
my $klass = ref $c || $c; |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
5
|
state $SHARE_DIR_CACHE; |
17
|
|
|
|
|
|
|
$SHARE_DIR_CACHE->{$klass} ||= sub { |
18
|
1
|
|
|
1
|
|
4
|
my $d1 = File::Spec->catfile($c->base_dir, 'share'); |
19
|
1
|
50
|
|
|
|
19
|
return $d1 if -d $d1; |
20
|
|
|
|
|
|
|
|
21
|
1
|
100
|
|
|
|
5
|
my $dist = first { $_ ne 'Puncheur' && $_->isa('Puncheur') } reverse @{mro::get_linear_isa($klass)}; |
|
2
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
19
|
|
22
|
1
|
|
|
|
|
5
|
$dist =~ s!::!-!g; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
2
|
local $@; |
25
|
1
|
|
|
|
|
3
|
my $d2 = eval { File::ShareDir::dist_dir($dist) }; |
|
1
|
|
|
|
|
8
|
|
26
|
1
|
50
|
33
|
|
|
840
|
return $d2 if $d2 && -d $d2; |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
9
|
return $d1; |
29
|
2
|
|
66
|
|
|
20
|
}->(); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |