line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Install::ShareFile; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
20542
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
86
|
|
6
|
1
|
|
|
1
|
|
4
|
use base qw/Module::Install::Base/; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
621
|
|
7
|
1
|
|
|
1
|
|
5
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
8
|
1
|
|
|
1
|
|
5
|
use File::Spec::Unix; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
570
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub install_sharefile { |
13
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
14
|
0
|
|
|
|
|
|
my $file = shift; |
15
|
0
|
|
|
|
|
|
my %args = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
0
|
|
|
|
unless ( defined $file and -f $file ) { |
18
|
0
|
|
|
|
|
|
Carp::croak("Illegal or missing file install_sharefile param: '$file'"); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
0
|
0
|
|
|
|
|
my $type = exists $args{type} ? $args{type} : 'dist'; |
22
|
0
|
0
|
0
|
|
|
|
unless ( defined $type and $type eq 'module' or $type eq 'dist' ) { |
|
|
|
0
|
|
|
|
|
23
|
0
|
|
|
|
|
|
die "Illegal or invalid share dir type '$type'"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Split by type |
27
|
0
|
0
|
|
|
|
|
my $S = ($^O eq 'MSWin32') ? "\\" : "\/"; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $from = File::Spec->catfile(File::Spec::Unix->splitdir($file)); |
30
|
0
|
0
|
|
|
|
|
my $dist = exists $args{dist} ? $args{dist} : $file; |
31
|
0
|
|
|
|
|
|
my @dist = File::Spec::Unix->splitdir($dist); |
32
|
0
|
|
|
|
|
|
my $to = File::Spec->catfile(@dist); |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
my $root; |
35
|
0
|
0
|
|
|
|
|
if ( $type eq 'dist' ) { |
36
|
|
|
|
|
|
|
# Set up the install |
37
|
0
|
|
|
|
|
|
$root = "\$(INST_LIB)${S}auto${S}share${S}dist${S}\$(DISTNAME)"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
|
my $module = Module::Install::_CLASS($args{module}); |
41
|
0
|
0
|
|
|
|
|
unless ( defined $module ) { |
42
|
0
|
|
|
|
|
|
die "Missing or invalid module name '$_[0]'"; |
43
|
|
|
|
|
|
|
} |
44
|
0
|
|
|
|
|
|
$module =~ s/::/-/g; |
45
|
0
|
|
|
|
|
|
$root = "\$(INST_LIB)${S}auto${S}share${S}module${S}$module"; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
my $postamble = ''; |
49
|
0
|
0
|
|
|
|
|
my $perm_dir = eval($ExtUtils::MakeMaker::VERSION >= 6.52) ? '$(PERM_DIR)' : 755; ## no critic |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
my @dist_dir = @dist; |
52
|
0
|
|
|
|
|
|
pop @dist_dir; |
53
|
0
|
|
|
|
|
|
my $dist_dir_stack = ''; |
54
|
0
|
|
|
|
|
|
for my $dist_dir ( @dist_dir ) { |
55
|
0
|
|
|
|
|
|
$dist_dir_stack .= $S . $dist_dir; |
56
|
0
|
|
|
|
|
|
$postamble .=<<"END"; |
57
|
|
|
|
|
|
|
\t\$(NOECHO) \$(MKPATH) "$root$dist_dir_stack" |
58
|
|
|
|
|
|
|
\t\$(NOECHO) \$(CHMOD) $perm_dir "$root$dist_dir_stack" |
59
|
|
|
|
|
|
|
END |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
0
|
|
|
|
|
|
$postamble .=<<"END"; |
63
|
|
|
|
|
|
|
\t\$(NOECHO) \$(CP) "$from" "$root${S}$to" |
64
|
|
|
|
|
|
|
END |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Set up the install |
67
|
0
|
|
|
|
|
|
$self->postamble(<<"END_MAKEFILE"); |
68
|
|
|
|
|
|
|
config :: |
69
|
|
|
|
|
|
|
$postamble |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
END_MAKEFILE |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
$self->build_requires( 'ExtUtils::MakeMaker' => '6.11' ); |
74
|
0
|
|
|
|
|
|
$self->no_index( file => $file ); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
__END__ |