line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Panda::Install::Payload; |
2
|
12
|
|
|
12
|
|
65
|
use strict; |
|
12
|
|
|
|
|
18
|
|
|
12
|
|
|
|
|
274
|
|
3
|
12
|
|
|
12
|
|
48
|
use warnings; |
|
12
|
|
|
|
|
18
|
|
|
12
|
|
|
|
|
219
|
|
4
|
12
|
|
|
12
|
|
46
|
use Cwd(); |
|
12
|
|
|
|
|
16
|
|
|
12
|
|
|
|
|
5288
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my %module_info; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub data_dir { |
9
|
34
|
|
|
34
|
0
|
50
|
my $module = pop; |
10
|
34
|
|
|
|
|
72
|
$module =~ s/::/\//g; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# first try search in loaded module's dir |
13
|
34
|
50
|
|
|
|
118
|
if (my $path = $INC{"$module.pm"}) { |
14
|
0
|
|
|
|
|
0
|
$path =~ s/\.pm$//; |
15
|
0
|
|
|
|
|
0
|
my $pldir = "$path.x"; |
16
|
0
|
0
|
|
|
|
0
|
return Cwd::realpath($pldir) if -d $pldir; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
34
|
|
|
|
|
65
|
foreach my $inc (@INC) { |
20
|
374
|
|
|
|
|
854
|
my $pldir = "$inc/$module.x"; |
21
|
374
|
50
|
|
|
|
2976
|
return Cwd::realpath($pldir) if -d $pldir; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
34
|
|
|
|
|
312
|
return undef; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub payload_dir { |
28
|
0
|
0
|
|
0
|
0
|
0
|
my $data_dir = data_dir(@_) or return undef; |
29
|
0
|
|
|
|
|
0
|
my $dir = "$data_dir/payload"; |
30
|
0
|
0
|
|
|
|
0
|
return $dir if -d $dir; |
31
|
0
|
|
|
|
|
0
|
return undef; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub include_dir { |
35
|
0
|
0
|
|
0
|
0
|
0
|
my $data_dir = data_dir(@_) or return undef; |
36
|
0
|
|
|
|
|
0
|
my $dir = "$data_dir/i"; |
37
|
0
|
0
|
|
|
|
0
|
return $dir if -d $dir; |
38
|
0
|
|
|
|
|
0
|
return undef; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub typemap_dir { |
42
|
0
|
0
|
|
0
|
0
|
0
|
my $data_dir = data_dir(@_) or return undef; |
43
|
0
|
|
|
|
|
0
|
my $dir = "$data_dir/tm"; |
44
|
0
|
0
|
|
|
|
0
|
return $dir if -d $dir; |
45
|
0
|
|
|
|
|
0
|
return undef; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub module_info_file { |
49
|
34
|
50
|
|
34
|
0
|
78
|
my $data_dir = data_dir(@_) or return undef; |
50
|
0
|
|
|
|
|
0
|
return "$data_dir/info"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub module_info { |
54
|
34
|
|
|
34
|
0
|
73
|
my $module = shift; |
55
|
34
|
|
|
|
|
51
|
my $info = $module_info{$module}; |
56
|
34
|
50
|
|
|
|
79
|
unless ($info) { |
57
|
34
|
50
|
|
|
|
80
|
my $file = module_info_file($module) or return undef; |
58
|
0
|
0
|
|
|
|
|
return undef unless -f $file; |
59
|
0
|
0
|
|
|
|
|
$info = require $file or return undef; |
60
|
0
|
|
|
|
|
|
$module_info{$module} = $info; |
61
|
|
|
|
|
|
|
} |
62
|
0
|
|
|
|
|
|
return $info; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub module_version { |
66
|
0
|
|
|
0
|
0
|
|
my $module = shift; |
67
|
0
|
|
|
|
|
|
my $path = $module; |
68
|
0
|
|
|
|
|
|
$path =~ s!::!/!g; |
69
|
0
|
0
|
|
|
|
|
eval { require $path.".pm"; } or return 0; |
|
0
|
|
|
|
|
|
|
70
|
12
|
|
|
12
|
|
84
|
no strict 'refs'; |
|
12
|
|
|
|
|
24
|
|
|
12
|
|
|
|
|
1020
|
|
71
|
0
|
|
|
|
|
|
my $v = ${$module."::VERSION"}; |
|
0
|
|
|
|
|
|
|
72
|
0
|
0
|
0
|
|
|
|
if (!$v and my $vsub = $module->can('VERSION')) { |
73
|
0
|
|
|
|
|
|
$v = $module->VERSION; |
74
|
|
|
|
|
|
|
} |
75
|
0
|
|
0
|
|
|
|
return $v || 0; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |