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