| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package ExtUtils::InstallPAR; |
|
2
|
1
|
|
|
1
|
|
734
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
3
|
1
|
|
|
1
|
|
6
|
use vars qw/$VERSION @ISA @EXPORT_OK %EXPORT_TAGS/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
88
|
|
|
4
|
|
|
|
|
|
|
BEGIN { |
|
5
|
1
|
|
|
1
|
|
26
|
$VERSION = '0.03'; |
|
6
|
|
|
|
|
|
|
} |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use Config; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Carp qw/croak/; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
617
|
|
|
10
|
|
|
|
|
|
|
require PAR::Dist; |
|
11
|
|
|
|
|
|
|
require Config; |
|
12
|
|
|
|
|
|
|
require File::Spec; |
|
13
|
|
|
|
|
|
|
require Exporter; |
|
14
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
|
15
|
|
|
|
|
|
|
%EXPORT_TAGS = ('all' => [qw(install)]); |
|
16
|
|
|
|
|
|
|
@EXPORT_OK = @{$EXPORT_TAGS{all}}; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
ExtUtils::InstallPAR - Install .par's into any installed perl |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use ExtUtils::InstallPAR; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Install into the currently running perl: |
|
27
|
|
|
|
|
|
|
ExtUtils::InstallPAR::install( |
|
28
|
|
|
|
|
|
|
par => './Foo-Bar-0.01-MSWin32-multi-thread-5.10.0.par', |
|
29
|
|
|
|
|
|
|
); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Install into a different perl on the system, |
|
32
|
|
|
|
|
|
|
# this requires the ExtUtils::Infer module. |
|
33
|
|
|
|
|
|
|
ExtUtils::InstallPAR::install( |
|
34
|
|
|
|
|
|
|
par => './Foo-Bar-0.01-MSWin32-multi-thread-5.10.0.par', |
|
35
|
|
|
|
|
|
|
perl => '/path/to/perl.exe', |
|
36
|
|
|
|
|
|
|
); |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# If LWP::Simple is available, it works with URLs, too: |
|
39
|
|
|
|
|
|
|
ExtUtils::InstallPAR::install( |
|
40
|
|
|
|
|
|
|
par => 'http://foo.com/Foo-Bar-0.01-MSWin32-multi-thread-5.10.0.par', |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This module installs PAR distributions (i.e. C<.par> files) into |
|
46
|
|
|
|
|
|
|
any perl installation on the system. The L module can |
|
47
|
|
|
|
|
|
|
install into the currently running perl by default and provides |
|
48
|
|
|
|
|
|
|
the necessary parameters to override any installation directories. |
|
49
|
|
|
|
|
|
|
Figuring out how to use those overrides in order to install into |
|
50
|
|
|
|
|
|
|
an arbitrary perl installation on the system may be beyond most users, |
|
51
|
|
|
|
|
|
|
however. Hence this convenience wrapper using L |
|
52
|
|
|
|
|
|
|
to automatically determine the typical I installation paths |
|
53
|
|
|
|
|
|
|
of any perl interpreter than can be executed by the current user. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 FUNCTIONS |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 install |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Install a PAR archive into any perl on the system. Takes named parameters: |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
C '/path/to/foo.par'> or C 'http://URL/to/foo.par'> |
|
62
|
|
|
|
|
|
|
specifies the path to the .par file to install or an URL to fetch it from |
|
63
|
|
|
|
|
|
|
(of LWP::Simple is available). This parameter is mandatory. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
The C '/path/to/perl'> parameter can be used to specify |
|
66
|
|
|
|
|
|
|
the perl interpreter to install into. If you omit this option or set |
|
67
|
|
|
|
|
|
|
it to C, the currently running perl will be used as target. |
|
68
|
|
|
|
|
|
|
If you want to install into different perls, you will need to |
|
69
|
|
|
|
|
|
|
install the C module. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
C $value> can be used to set the verbosity of the |
|
72
|
|
|
|
|
|
|
installation process. Defaults to C<1>. |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=cut |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub install { |
|
77
|
0
|
0
|
|
0
|
1
|
|
shift if $_[0] =~ __PACKAGE__; |
|
78
|
0
|
|
|
|
|
|
my %args = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
|
|
|
|
|
my $par = $args{par}; |
|
81
|
0
|
|
|
|
|
|
my $perl = $args{perl}; |
|
82
|
0
|
|
0
|
|
|
|
my $verbosity = $args{verbosity} || 0; |
|
83
|
0
|
0
|
|
|
|
|
if (not defined $par) { |
|
84
|
0
|
|
|
|
|
|
croak(__PACKAGE__."::install requires a 'par' parameter"); |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
my $name = $par; |
|
88
|
0
|
|
|
|
|
|
$name =~ s/^\w+:\/\///; |
|
89
|
0
|
|
|
|
|
|
my @name_elems = PAR::Dist::parse_dist_name($name); |
|
90
|
0
|
0
|
|
|
|
|
if (2 <= grep {defined} @name_elems) { |
|
|
0
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
$name = join('-', @name_elems); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
else { |
|
94
|
0
|
|
|
|
|
|
(undef, undef, my $file) = File::Spec->splitpath($name); |
|
95
|
0
|
|
|
|
|
|
$name = $file; |
|
96
|
0
|
|
|
|
|
|
$name =~ s/\.par$//i; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
my $config; |
|
100
|
0
|
0
|
|
|
|
|
if (defined $perl) { |
|
101
|
0
|
|
|
|
|
|
require ExtUtils::InferConfig; |
|
102
|
0
|
|
|
|
|
|
my $eic = ExtUtils::InferConfig->new( |
|
103
|
|
|
|
|
|
|
perl => $perl, |
|
104
|
|
|
|
|
|
|
); |
|
105
|
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
$config = $eic->get_config(); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
else { |
|
109
|
0
|
|
|
|
|
|
$config = \%Config::Config; |
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
|
|
112
|
0
|
|
|
|
|
|
my $par_target = { |
|
113
|
|
|
|
|
|
|
inst_lib => $config->{installsitelib}, |
|
114
|
|
|
|
|
|
|
inst_archlib => $config->{installsitearch}, |
|
115
|
|
|
|
|
|
|
inst_bin => $config->{installbin}, |
|
116
|
|
|
|
|
|
|
inst_script => $config->{installscript}, |
|
117
|
|
|
|
|
|
|
inst_man1dir => $config->{installman1dir}, |
|
118
|
|
|
|
|
|
|
inst_man3dir => $config->{installman3dir}, |
|
119
|
|
|
|
|
|
|
packlist_write => $config->{sitearchexp} . "/auto/$name/.packlist", |
|
120
|
|
|
|
|
|
|
packlist_read => $config->{sitearchexp} . "/auto/$name/.packlist", |
|
121
|
|
|
|
|
|
|
}; |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
0
|
|
|
|
|
|
return PAR::Dist::install_par( |
|
125
|
|
|
|
|
|
|
name => $name, |
|
126
|
|
|
|
|
|
|
dist => $par, |
|
127
|
|
|
|
|
|
|
%$par_target, |
|
128
|
|
|
|
|
|
|
auto_inst_lib_conversion => 1, |
|
129
|
|
|
|
|
|
|
); |
|
130
|
|
|
|
|
|
|
} |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
|
133
|
|
|
|
|
|
|
__END__ |