line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Module::Plan::Lite; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Module::Plan::Lite - Lite installation scripts for third-party modules |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
The following is the contents of your default.pip file. |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Module::Plan::Lite |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Everything in the plan file is installed in order |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Supported file forms |
18
|
|
|
|
|
|
|
Install-This-First-1.00.tar.gz |
19
|
|
|
|
|
|
|
Install-This-Second.1.31.tar.gz |
20
|
|
|
|
|
|
|
extensions/This-This-0.02.tar.gz |
21
|
|
|
|
|
|
|
/absolute/Module-Location-4.12.tar.gz |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Supported URI types |
24
|
|
|
|
|
|
|
ftp://foo.com/pip-0.13.tar.gz |
25
|
|
|
|
|
|
|
http://foo.com/pip-0.13.tar.gz |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Support for PAR installation and conventions |
28
|
|
|
|
|
|
|
http://foo.com/DBI-1.37-MSWin32-5.8.0.par |
29
|
|
|
|
|
|
|
http://foo.com/DBI-1.37 |
30
|
|
|
|
|
|
|
cpan://SMUELLER/PAR-Packer-0.975 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
3
|
|
|
3
|
|
1662
|
use strict; |
|
3
|
|
|
|
|
32
|
|
|
3
|
|
|
|
|
127
|
|
35
|
3
|
|
|
3
|
|
37
|
use URI (); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
49
|
|
36
|
3
|
|
|
3
|
|
19
|
use Module::Plan::Base (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
68
|
|
37
|
|
|
|
|
|
|
|
38
|
3
|
|
|
3
|
|
18
|
use vars qw{$VERSION @ISA}; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
263
|
|
39
|
|
|
|
|
|
|
BEGIN { |
40
|
3
|
|
|
3
|
|
8
|
$VERSION = '1.19'; |
41
|
3
|
|
|
|
|
1623
|
@ISA = 'Module::Plan::Base'; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
##################################################################### |
49
|
|
|
|
|
|
|
# Constructor |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub new { |
52
|
2
|
|
|
2
|
0
|
5
|
my $class = shift; |
53
|
2
|
|
|
|
|
17
|
my $self = $class->SUPER::new(@_); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Parsing here isn't the best, but this is Lite after all |
56
|
2
|
|
|
|
|
23
|
foreach ( $self->lines ) { |
57
|
|
|
|
|
|
|
# Strip whitespace and comments |
58
|
6
|
100
|
|
|
|
28
|
next if /^\s*(?:\#|$)/; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Create the URI |
61
|
4
|
|
|
|
|
20
|
my $uri = URI->new_abs( $_, $self->p5i_uri ); |
62
|
4
|
50
|
|
|
|
1426
|
unless ( $uri ) { |
63
|
0
|
|
|
|
|
0
|
croak("Failed to get the URI for $_"); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# Add the uri |
67
|
4
|
|
|
|
|
60
|
$self->add_uri( $uri ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
2
|
|
|
|
|
19
|
$self; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub fetch { |
74
|
1
|
|
|
1
|
0
|
1063
|
my $self = shift; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Download the needed modules |
77
|
1
|
|
|
|
|
10
|
foreach my $name ( $self->names ) { |
78
|
2
|
50
|
|
|
|
10
|
next if $self->{dists}->{$name}; |
79
|
2
|
|
|
|
|
16
|
$self->_fetch_uri($name); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
1
|
|
|
|
|
13
|
return 1; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub run { |
86
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# Download the needed modules |
89
|
0
|
|
|
|
|
|
foreach my $name ( $self->names ) { |
90
|
0
|
0
|
|
|
|
|
next if $name =~ /(\.par|[\d.]+)$/; |
91
|
0
|
0
|
|
|
|
|
next if $self->{dists}->{$name}; |
92
|
0
|
|
|
|
|
|
$self->_fetch_uri($name); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
# Inject them into CPAN and install |
96
|
0
|
|
|
|
|
|
foreach my $name ( $self->names ) { |
97
|
|
|
|
|
|
|
# Install via PAR::Dist |
98
|
0
|
0
|
|
|
|
|
if ( $name =~ /(\.par|[\d.]+)$/ ) { |
99
|
0
|
|
|
|
|
|
$self->_par_install($name); |
100
|
0
|
|
|
|
|
|
next; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
# Install via CPAN.pm |
104
|
0
|
|
|
|
|
|
$self->_cpan_inject($name); |
105
|
0
|
|
|
|
|
|
$self->_cpan_install($name); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
|
return 1; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=pod |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SUPPORT |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
See the main L module for support information. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 AUTHORS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Adam Kennedy Eadamk@cpan.orgE |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L, L |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 COPYRIGHT |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Copyright 2006 - 2010 Adam Kennedy. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This program is free software; you can redistribute |
132
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
The full text of the license can be found in the |
135
|
|
|
|
|
|
|
LICENSE file included with this module. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |