line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#line 1 |
2
|
|
|
|
|
|
|
package Module::Install::Metadata; |
3
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
226
|
use strict 'vars'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
29
|
|
5
|
|
|
|
|
|
|
use Module::Install::Base; |
6
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
92
|
|
7
|
|
|
|
|
|
|
use vars qw{$VERSION $ISCORE @ISA}; |
8
|
1
|
|
|
1
|
|
2
|
BEGIN { |
9
|
1
|
|
|
|
|
2
|
$VERSION = '0.75'; |
10
|
1
|
|
|
|
|
3403
|
$ISCORE = 1; |
11
|
|
|
|
|
|
|
@ISA = qw{Module::Install::Base}; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my @scalar_keys = qw{ |
15
|
|
|
|
|
|
|
name |
16
|
|
|
|
|
|
|
module_name |
17
|
|
|
|
|
|
|
abstract |
18
|
|
|
|
|
|
|
author |
19
|
|
|
|
|
|
|
version |
20
|
|
|
|
|
|
|
license |
21
|
|
|
|
|
|
|
distribution_type |
22
|
|
|
|
|
|
|
perl_version |
23
|
|
|
|
|
|
|
tests |
24
|
|
|
|
|
|
|
installdirs |
25
|
|
|
|
|
|
|
}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my @tuple_keys = qw{ |
28
|
|
|
|
|
|
|
configure_requires |
29
|
|
|
|
|
|
|
build_requires |
30
|
|
|
|
|
|
|
requires |
31
|
|
|
|
|
|
|
recommends |
32
|
|
|
|
|
|
|
bundles |
33
|
|
|
|
|
|
|
resources |
34
|
|
|
|
|
|
|
}; |
35
|
0
|
|
|
0
|
0
|
0
|
|
36
|
0
|
|
|
0
|
0
|
0
|
sub Meta { shift } |
37
|
0
|
|
|
0
|
0
|
0
|
sub Meta_ScalarKeys { @scalar_keys } |
38
|
|
|
|
|
|
|
sub Meta_TupleKeys { @tuple_keys } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
foreach my $key (@scalar_keys) { |
41
|
13
|
|
|
13
|
|
7004
|
*$key = sub { |
42
|
13
|
100
|
66
|
|
|
181
|
my $self = shift; |
43
|
6
|
|
|
|
|
64
|
return $self->{values}{$key} if defined wantarray and !@_; |
44
|
6
|
|
|
|
|
22
|
$self->{values}{$key} = shift; |
45
|
|
|
|
|
|
|
return $self; |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
9
|
|
|
9
|
0
|
77
|
sub requires { |
50
|
9
|
|
|
|
|
57
|
my $self = shift; |
51
|
8
|
50
|
|
|
|
62
|
while ( @_ ) { |
52
|
8
|
|
100
|
|
|
107
|
my $module = shift or last; |
53
|
8
|
|
|
|
|
22
|
my $version = shift || 0; |
|
8
|
|
|
|
|
134
|
|
54
|
|
|
|
|
|
|
push @{ $self->{values}->{requires} }, [ $module, $version ]; |
55
|
9
|
|
|
|
|
98
|
} |
56
|
|
|
|
|
|
|
$self->{values}{requires}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
1
|
0
|
14
|
sub build_requires { |
60
|
1
|
|
|
|
|
14
|
my $self = shift; |
61
|
0
|
0
|
|
|
|
0
|
while ( @_ ) { |
62
|
0
|
|
0
|
|
|
0
|
my $module = shift or last; |
63
|
0
|
|
|
|
|
0
|
my $version = shift || 0; |
|
0
|
|
|
|
|
0
|
|
64
|
|
|
|
|
|
|
push @{ $self->{values}->{build_requires} }, [ $module, $version ]; |
65
|
1
|
|
|
|
|
32
|
} |
66
|
|
|
|
|
|
|
$self->{values}{build_requires}; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
0
|
|
|
0
|
0
|
0
|
sub configure_requires { |
70
|
0
|
|
|
|
|
0
|
my $self = shift; |
71
|
0
|
0
|
|
|
|
0
|
while ( @_ ) { |
72
|
0
|
|
0
|
|
|
0
|
my $module = shift or last; |
73
|
0
|
|
|
|
|
0
|
my $version = shift || 0; |
|
0
|
|
|
|
|
0
|
|
74
|
|
|
|
|
|
|
push @{ $self->{values}->{configure_requires} }, [ $module, $version ]; |
75
|
0
|
|
|
|
|
0
|
} |
76
|
|
|
|
|
|
|
$self->{values}->{configure_requires}; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
0
|
0
|
0
|
sub recommends { |
80
|
0
|
|
|
|
|
0
|
my $self = shift; |
81
|
0
|
0
|
|
|
|
0
|
while ( @_ ) { |
82
|
0
|
|
0
|
|
|
0
|
my $module = shift or last; |
83
|
0
|
|
|
|
|
0
|
my $version = shift || 0; |
|
0
|
|
|
|
|
0
|
|
84
|
|
|
|
|
|
|
push @{ $self->{values}->{recommends} }, [ $module, $version ]; |
85
|
0
|
|
|
|
|
0
|
} |
86
|
|
|
|
|
|
|
$self->{values}->{recommends}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
0
|
|
|
0
|
0
|
0
|
sub bundles { |
90
|
0
|
|
|
|
|
0
|
my $self = shift; |
91
|
0
|
0
|
|
|
|
0
|
while ( @_ ) { |
92
|
0
|
|
0
|
|
|
0
|
my $module = shift or last; |
93
|
0
|
|
|
|
|
0
|
my $version = shift || 0; |
|
0
|
|
|
|
|
0
|
|
94
|
|
|
|
|
|
|
push @{ $self->{values}->{bundles} }, [ $module, $version ]; |
95
|
0
|
|
|
|
|
0
|
} |
96
|
|
|
|
|
|
|
$self->{values}->{bundles}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Resource handling |
100
|
0
|
|
|
0
|
0
|
0
|
sub resources { |
101
|
0
|
|
|
|
|
0
|
my $self = shift; |
102
|
0
|
0
|
|
|
|
0
|
while ( @_ ) { |
103
|
0
|
0
|
|
|
|
0
|
my $resource = shift or last; |
104
|
0
|
|
|
|
|
0
|
my $value = shift or next; |
|
0
|
|
|
|
|
0
|
|
105
|
|
|
|
|
|
|
push @{ $self->{values}->{resources} }, [ $resource, $value ]; |
106
|
0
|
|
|
|
|
0
|
} |
107
|
|
|
|
|
|
|
$self->{values}->{resources}; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
0
|
|
|
0
|
0
|
0
|
sub repository { |
111
|
0
|
|
|
|
|
0
|
my $self = shift; |
112
|
0
|
|
|
|
|
0
|
$self->resources( repository => shift ); |
113
|
|
|
|
|
|
|
return 1; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# Aliases for build_requires that will have alternative |
117
|
0
|
|
|
0
|
0
|
0
|
# meanings in some future version of META.yml. |
118
|
0
|
|
|
0
|
0
|
0
|
sub test_requires { shift->build_requires(@_) } |
119
|
|
|
|
|
|
|
sub install_requires { shift->build_requires(@_) } |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
0
|
0
|
0
|
# Aliases for installdirs options |
122
|
0
|
|
|
0
|
0
|
0
|
sub install_as_core { $_[0]->installdirs('perl') } |
123
|
0
|
|
|
0
|
0
|
0
|
sub install_as_cpan { $_[0]->installdirs('site') } |
124
|
0
|
|
|
0
|
0
|
0
|
sub install_as_site { $_[0]->installdirs('site') } |
125
|
|
|
|
|
|
|
sub install_as_vendor { $_[0]->installdirs('vendor') } |
126
|
|
|
|
|
|
|
|
127
|
0
|
|
|
0
|
0
|
0
|
sub sign { |
128
|
0
|
0
|
0
|
|
|
0
|
my $self = shift; |
129
|
0
|
0
|
|
|
|
0
|
return $self->{'values'}{'sign'} if defined wantarray and ! @_; |
130
|
0
|
|
|
|
|
0
|
$self->{'values'}{'sign'} = ( @_ ? $_[0] : 1 ); |
131
|
|
|
|
|
|
|
return $self; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
0
|
0
|
0
|
sub dynamic_config { |
135
|
0
|
0
|
|
|
|
0
|
my $self = shift; |
136
|
0
|
|
|
|
|
0
|
unless ( @_ ) { |
137
|
0
|
|
|
|
|
0
|
warn "You MUST provide an explicit true/false value to dynamic_config, skipping\n"; |
138
|
|
|
|
|
|
|
return $self; |
139
|
0
|
0
|
|
|
|
0
|
} |
140
|
0
|
|
|
|
|
0
|
$self->{values}{dynamic_config} = $_[0] ? 1 : 0; |
141
|
|
|
|
|
|
|
return $self; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
1
|
|
|
1
|
0
|
30
|
sub all_from { |
145
|
|
|
|
|
|
|
my ( $self, $file ) = @_; |
146
|
1
|
50
|
|
|
|
19
|
|
147
|
0
|
0
|
|
|
|
0
|
unless ( defined($file) ) { |
148
|
|
|
|
|
|
|
my $name = $self->name |
149
|
0
|
|
|
|
|
0
|
or die "all_from called with no args without setting name() first"; |
150
|
0
|
0
|
|
|
|
0
|
$file = join('/', 'lib', split(/-/, $name)) . '.pm'; |
151
|
0
|
0
|
|
|
|
0
|
$file =~ s{.*/}{} unless -e $file; |
152
|
|
|
|
|
|
|
die "all_from: cannot find $file from $name" unless -e $file; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
# Some methods pull from POD instead of code. |
156
|
1
|
|
|
|
|
12
|
# If there is a matching .pod, use that instead |
157
|
1
|
|
|
|
|
20
|
my $pod = $file; |
158
|
1
|
50
|
|
|
|
50
|
$pod =~ s/\.pm$/.pod/i; |
159
|
|
|
|
|
|
|
$pod = $file unless -e $pod; |
160
|
|
|
|
|
|
|
|
161
|
1
|
50
|
|
|
|
30
|
# Pull the different values |
162
|
1
|
50
|
|
|
|
15
|
$self->name_from($file) unless $self->name; |
163
|
1
|
50
|
|
|
|
12
|
$self->version_from($file) unless $self->version; |
164
|
1
|
50
|
|
|
|
11
|
$self->perl_version_from($file) unless $self->perl_version; |
165
|
1
|
50
|
|
|
|
16
|
$self->author_from($pod) unless $self->author; |
166
|
1
|
50
|
|
|
|
11
|
$self->license_from($pod) unless $self->license; |
167
|
|
|
|
|
|
|
$self->abstract_from($pod) unless $self->abstract; |
168
|
1
|
|
|
|
|
45
|
|
169
|
|
|
|
|
|
|
return 1; |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
|
172
|
0
|
|
|
0
|
0
|
0
|
sub provides { |
173
|
0
|
|
0
|
|
|
0
|
my $self = shift; |
174
|
0
|
0
|
|
|
|
0
|
my $provides = ( $self->{values}{provides} ||= {} ); |
175
|
0
|
|
|
|
|
0
|
%$provides = (%$provides, @_) if @_; |
176
|
|
|
|
|
|
|
return $provides; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
0
|
0
|
0
|
sub auto_provides { |
180
|
0
|
0
|
|
|
|
0
|
my $self = shift; |
181
|
0
|
0
|
|
|
|
0
|
return $self unless $self->is_admin; |
182
|
0
|
|
|
|
|
0
|
unless (-e 'MANIFEST') { |
183
|
0
|
|
|
|
|
0
|
warn "Cannot deduce auto_provides without a MANIFEST, skipping\n"; |
184
|
|
|
|
|
|
|
return $self; |
185
|
|
|
|
|
|
|
} |
186
|
0
|
|
|
0
|
|
0
|
# Avoid spurious warnings as we are not checking manifest here. |
|
0
|
|
|
|
|
0
|
|
187
|
0
|
|
|
|
|
0
|
local $SIG{__WARN__} = sub {1}; |
188
|
0
|
|
|
0
|
|
0
|
require ExtUtils::Manifest; |
|
0
|
|
|
|
|
0
|
|
189
|
|
|
|
|
|
|
local *ExtUtils::Manifest::manicheck = sub { return }; |
190
|
0
|
|
|
|
|
0
|
|
191
|
0
|
|
|
|
|
0
|
require Module::Build; |
192
|
|
|
|
|
|
|
my $build = Module::Build->new( |
193
|
|
|
|
|
|
|
dist_name => $self->name, |
194
|
|
|
|
|
|
|
dist_version => $self->version, |
195
|
|
|
|
|
|
|
license => $self->license, |
196
|
0
|
0
|
|
|
|
0
|
); |
|
0
|
|
|
|
|
0
|
|
197
|
|
|
|
|
|
|
$self->provides( %{ $build->find_dist_packages || {} } ); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
0
|
0
|
0
|
sub feature { |
201
|
0
|
|
|
|
|
0
|
my $self = shift; |
202
|
0
|
|
0
|
|
|
0
|
my $name = shift; |
203
|
0
|
|
|
|
|
0
|
my $features = ( $self->{values}{features} ||= [] ); |
204
|
|
|
|
|
|
|
my $mods; |
205
|
0
|
0
|
0
|
|
|
0
|
|
206
|
|
|
|
|
|
|
if ( @_ == 1 and ref( $_[0] ) ) { |
207
|
|
|
|
|
|
|
# The user used ->feature like ->features by passing in the second |
208
|
0
|
|
|
|
|
0
|
# argument as a reference. Accomodate for that. |
209
|
|
|
|
|
|
|
$mods = $_[0]; |
210
|
0
|
|
|
|
|
0
|
} else { |
211
|
|
|
|
|
|
|
$mods = \@_; |
212
|
|
|
|
|
|
|
} |
213
|
0
|
|
|
|
|
0
|
|
214
|
0
|
0
|
|
|
|
0
|
my $count = 0; |
|
|
0
|
|
|
|
|
|
215
|
|
|
|
|
|
|
push @$features, ( |
216
|
|
|
|
|
|
|
$name => [ |
217
|
0
|
|
|
|
|
0
|
map { |
218
|
|
|
|
|
|
|
ref($_) ? ( ref($_) eq 'HASH' ) ? %$_ : @$_ : $_ |
219
|
|
|
|
|
|
|
} @$mods |
220
|
|
|
|
|
|
|
] |
221
|
|
|
|
|
|
|
); |
222
|
0
|
|
|
|
|
0
|
|
223
|
|
|
|
|
|
|
return @$features; |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
0
|
|
|
0
|
0
|
0
|
sub features { |
227
|
0
|
|
|
|
|
0
|
my $self = shift; |
228
|
0
|
|
|
|
|
0
|
while ( my ( $name, $mods ) = splice( @_, 0, 2 ) ) { |
229
|
|
|
|
|
|
|
$self->feature( $name, @$mods ); |
230
|
0
|
|
|
|
|
0
|
} |
231
|
0
|
0
|
|
|
|
0
|
return $self->{values}->{features} |
232
|
|
|
|
|
|
|
? @{ $self->{values}->{features} } |
233
|
|
|
|
|
|
|
: (); |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
0
|
|
|
0
|
0
|
0
|
sub no_index { |
237
|
0
|
|
|
|
|
0
|
my $self = shift; |
238
|
0
|
0
|
|
|
|
0
|
my $type = shift; |
|
0
|
|
|
|
|
0
|
|
239
|
0
|
|
|
|
|
0
|
push @{ $self->{values}{no_index}{$type} }, @_ if $type; |
240
|
|
|
|
|
|
|
return $self->{values}{no_index}; |
241
|
|
|
|
|
|
|
} |
242
|
|
|
|
|
|
|
|
243
|
0
|
|
|
0
|
0
|
0
|
sub read { |
244
|
0
|
|
|
|
|
0
|
my $self = shift; |
245
|
|
|
|
|
|
|
$self->include_deps( 'YAML::Tiny', 0 ); |
246
|
0
|
|
|
|
|
0
|
|
247
|
0
|
|
|
|
|
0
|
require YAML::Tiny; |
248
|
|
|
|
|
|
|
my $data = YAML::Tiny::LoadFile('META.yml'); |
249
|
|
|
|
|
|
|
|
250
|
0
|
|
|
|
|
0
|
# Call methods explicitly in case user has already set some values. |
251
|
0
|
0
|
|
|
|
0
|
while ( my ( $key, $value ) = each %$data ) { |
252
|
0
|
0
|
|
|
|
0
|
next unless $self->can($key); |
253
|
0
|
|
|
|
|
0
|
if ( ref $value eq 'HASH' ) { |
254
|
0
|
|
|
|
|
0
|
while ( my ( $module, $version ) = each %$value ) { |
255
|
|
|
|
|
|
|
$self->can($key)->($self, $module => $version ); |
256
|
|
|
|
|
|
|
} |
257
|
0
|
|
|
|
|
0
|
} else { |
258
|
|
|
|
|
|
|
$self->can($key)->($self, $value); |
259
|
|
|
|
|
|
|
} |
260
|
0
|
|
|
|
|
0
|
} |
261
|
|
|
|
|
|
|
return $self; |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
0
|
|
|
0
|
0
|
0
|
sub write { |
265
|
0
|
0
|
|
|
|
0
|
my $self = shift; |
266
|
0
|
|
|
|
|
0
|
return $self unless $self->is_admin; |
267
|
0
|
|
|
|
|
0
|
$self->admin->write_meta; |
268
|
|
|
|
|
|
|
return $self; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
1
|
|
|
1
|
0
|
34
|
sub version_from { |
272
|
1
|
|
|
|
|
9
|
require ExtUtils::MM_Unix; |
273
|
1
|
|
|
|
|
58
|
my ( $self, $file ) = @_; |
274
|
|
|
|
|
|
|
$self->version( ExtUtils::MM_Unix->parse_version($file) ); |
275
|
|
|
|
|
|
|
} |
276
|
|
|
|
|
|
|
|
277
|
1
|
|
|
1
|
0
|
16
|
sub abstract_from { |
278
|
1
|
|
|
|
|
8
|
require ExtUtils::MM_Unix; |
279
|
1
|
|
|
|
|
8
|
my ( $self, $file ) = @_; |
280
|
|
|
|
|
|
|
$self->abstract( |
281
|
|
|
|
|
|
|
bless( |
282
|
|
|
|
|
|
|
{ DISTNAME => $self->name }, |
283
|
|
|
|
|
|
|
'ExtUtils::MM_Unix' |
284
|
|
|
|
|
|
|
)->parse_abstract($file) |
285
|
|
|
|
|
|
|
); |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
# Add both distribution and module name |
289
|
0
|
|
|
0
|
0
|
0
|
sub name_from { |
290
|
0
|
0
|
|
|
|
0
|
my ($self, $file) = @_; |
291
|
|
|
|
|
|
|
if ( |
292
|
|
|
|
|
|
|
Module::Install::_read($file) =~ m/ |
293
|
|
|
|
|
|
|
^ \s* |
294
|
|
|
|
|
|
|
package \s* |
295
|
|
|
|
|
|
|
([\w:]+) |
296
|
|
|
|
|
|
|
\s* ; |
297
|
|
|
|
|
|
|
/ixms |
298
|
0
|
|
|
|
|
0
|
) { |
299
|
0
|
|
|
|
|
0
|
my ($name, $module_name) = ($1, $1); |
300
|
0
|
|
|
|
|
0
|
$name =~ s{::}{-}g; |
301
|
0
|
0
|
|
|
|
0
|
$self->name($name); |
302
|
0
|
|
|
|
|
0
|
unless ( $self->module_name ) { |
303
|
|
|
|
|
|
|
$self->module_name($module_name); |
304
|
|
|
|
|
|
|
} |
305
|
0
|
|
|
|
|
0
|
} else { |
306
|
|
|
|
|
|
|
die "Cannot determine name from $file\n"; |
307
|
|
|
|
|
|
|
} |
308
|
|
|
|
|
|
|
} |
309
|
|
|
|
|
|
|
|
310
|
1
|
|
|
1
|
0
|
3
|
sub perl_version_from { |
311
|
1
|
50
|
|
|
|
17
|
my $self = shift; |
312
|
|
|
|
|
|
|
if ( |
313
|
|
|
|
|
|
|
Module::Install::_read($_[0]) =~ m/ |
314
|
|
|
|
|
|
|
^ |
315
|
|
|
|
|
|
|
(?:use|require) \s* |
316
|
|
|
|
|
|
|
v? |
317
|
|
|
|
|
|
|
([\d_\.]+) |
318
|
|
|
|
|
|
|
\s* ; |
319
|
|
|
|
|
|
|
/ixms |
320
|
1
|
|
|
|
|
3
|
) { |
321
|
1
|
|
|
|
|
5
|
my $perl_version = $1; |
322
|
1
|
|
|
|
|
5
|
$perl_version =~ s{_}{}g; |
323
|
|
|
|
|
|
|
$self->perl_version($perl_version); |
324
|
0
|
|
|
|
|
0
|
} else { |
325
|
0
|
|
|
|
|
0
|
warn "Cannot determine perl version info from $_[0]\n"; |
326
|
|
|
|
|
|
|
return; |
327
|
|
|
|
|
|
|
} |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
0
|
|
|
0
|
0
|
0
|
sub author_from { |
331
|
0
|
|
|
|
|
0
|
my $self = shift; |
332
|
0
|
0
|
|
|
|
0
|
my $content = Module::Install::_read($_[0]); |
333
|
|
|
|
|
|
|
if ($content =~ m/ |
334
|
|
|
|
|
|
|
=head \d \s+ (?:authors?)\b \s* |
335
|
|
|
|
|
|
|
([^\n]*) |
336
|
|
|
|
|
|
|
| |
337
|
|
|
|
|
|
|
=head \d \s+ (?:licen[cs]e|licensing|copyright|legal)\b \s* |
338
|
|
|
|
|
|
|
.*? copyright .*? \d\d\d[\d.]+ \s* (?:\bby\b)? \s* |
339
|
|
|
|
|
|
|
([^\n]*) |
340
|
0
|
|
0
|
|
|
0
|
/ixms) { |
341
|
0
|
|
|
|
|
0
|
my $author = $1 || $2; |
342
|
0
|
|
|
|
|
0
|
$author =~ s{E}{<}g; |
343
|
0
|
|
|
|
|
0
|
$author =~ s{E}{>}g; |
344
|
|
|
|
|
|
|
$self->author($author); |
345
|
0
|
|
|
|
|
0
|
} else { |
346
|
|
|
|
|
|
|
warn "Cannot determine author info from $_[0]\n"; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
|
350
|
0
|
|
|
0
|
0
|
0
|
sub license_from { |
351
|
0
|
0
|
|
|
|
0
|
my $self = shift; |
352
|
|
|
|
|
|
|
if ( |
353
|
|
|
|
|
|
|
Module::Install::_read($_[0]) =~ m/ |
354
|
|
|
|
|
|
|
( |
355
|
|
|
|
|
|
|
=head \d \s+ |
356
|
|
|
|
|
|
|
(?:licen[cs]e|licensing|copyright|legal)\b |
357
|
|
|
|
|
|
|
.*? |
358
|
|
|
|
|
|
|
) |
359
|
|
|
|
|
|
|
(=head\\d.*|=cut.*|) |
360
|
|
|
|
|
|
|
\z |
361
|
0
|
|
|
|
|
0
|
/ixms ) { |
362
|
0
|
|
|
|
|
0
|
my $license_text = $1; |
363
|
|
|
|
|
|
|
my @phrases = ( |
364
|
|
|
|
|
|
|
'under the same (?:terms|license) as perl itself' => 'perl', 1, |
365
|
|
|
|
|
|
|
'GNU public license' => 'gpl', 1, |
366
|
|
|
|
|
|
|
'GNU lesser public license' => 'lgpl', 1, |
367
|
|
|
|
|
|
|
'BSD license' => 'bsd', 1, |
368
|
|
|
|
|
|
|
'Artistic license' => 'artistic', 1, |
369
|
|
|
|
|
|
|
'GPL' => 'gpl', 1, |
370
|
|
|
|
|
|
|
'LGPL' => 'lgpl', 1, |
371
|
|
|
|
|
|
|
'BSD' => 'bsd', 1, |
372
|
|
|
|
|
|
|
'Artistic' => 'artistic', 1, |
373
|
|
|
|
|
|
|
'MIT' => 'mit', 1, |
374
|
|
|
|
|
|
|
'proprietary' => 'proprietary', 0, |
375
|
0
|
|
|
|
|
0
|
); |
376
|
0
|
|
|
|
|
0
|
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) { |
377
|
0
|
0
|
|
|
|
0
|
$pattern =~ s{\s+}{\\s+}g; |
378
|
0
|
0
|
0
|
|
|
0
|
if ( $license_text =~ /\b$pattern\b/i ) { |
379
|
0
|
|
|
|
|
0
|
if ( $osi and $license_text =~ /All rights reserved/i ) { |
380
|
|
|
|
|
|
|
print "WARNING: 'All rights reserved' in copyright may invalidate Open Source license.\n"; |
381
|
0
|
|
|
|
|
0
|
} |
382
|
0
|
|
|
|
|
0
|
$self->license($license); |
383
|
|
|
|
|
|
|
return 1; |
384
|
|
|
|
|
|
|
} |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
} |
387
|
0
|
|
|
|
|
0
|
|
388
|
0
|
|
|
|
|
0
|
warn "Cannot determine license info from $_[0]\n"; |
389
|
|
|
|
|
|
|
return 'unknown'; |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
1
|
|
|
1
|
0
|
25
|
sub install_script { |
393
|
1
|
|
|
|
|
194
|
my $self = shift; |
394
|
1
|
|
50
|
|
|
34
|
my $args = $self->makemaker_args; |
395
|
1
|
|
|
|
|
20
|
my $exe = $args->{EXE_FILES} ||= []; |
396
|
1
|
50
|
0
|
|
|
41
|
foreach ( @_ ) { |
|
|
0
|
|
|
|
|
|
397
|
1
|
|
|
|
|
44
|
if ( -f $_ ) { |
398
|
|
|
|
|
|
|
push @$exe, $_; |
399
|
0
|
|
|
|
|
|
} elsif ( -d 'script' and -f "script/$_" ) { |
400
|
|
|
|
|
|
|
push @$exe, "script/$_"; |
401
|
0
|
|
|
|
|
|
} else { |
402
|
|
|
|
|
|
|
die "Cannot find script '$_'"; |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
} |
405
|
|
|
|
|
|
|
} |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
1; |