178
178
$self->{values}->{perl_version} = $version;
183
perl => 'http://dev.perl.org/licenses/',
184
apache => 'http://apache.org/licenses/LICENSE-2.0',
185
artistic => 'http://opensource.org/licenses/artistic-license.php',
186
artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
187
lgpl => 'http://opensource.org/licenses/lgpl-license.php',
188
lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
189
lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
190
bsd => 'http://opensource.org/licenses/bsd-license.php',
191
gpl => 'http://opensource.org/licenses/gpl-license.php',
192
gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
193
gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
194
mit => 'http://opensource.org/licenses/mit-license.php',
195
mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
196
open_source => undef,
197
unrestricted => undef,
198
restrictive => undef,
204
return $self->{values}->{license} unless @_;
205
my $license = shift or die(
206
'Did not provide a value to license()'
208
$self->{values}->{license} = $license;
210
# Automatically fill in license URLs
211
if ( $license_urls{$license} ) {
212
$self->resources( license => $license_urls{$license} );
219
182
my ( $self, $file ) = @_;
450
perl => 'http://dev.perl.org/licenses/',
451
apache => 'http://apache.org/licenses/LICENSE-2.0',
452
apache_1_1 => 'http://apache.org/licenses/LICENSE-1.1',
453
artistic => 'http://opensource.org/licenses/artistic-license.php',
454
artistic_2 => 'http://opensource.org/licenses/artistic-license-2.0.php',
455
lgpl => 'http://opensource.org/licenses/lgpl-license.php',
456
lgpl2 => 'http://opensource.org/licenses/lgpl-2.1.php',
457
lgpl3 => 'http://opensource.org/licenses/lgpl-3.0.html',
458
bsd => 'http://opensource.org/licenses/bsd-license.php',
459
gpl => 'http://opensource.org/licenses/gpl-license.php',
460
gpl2 => 'http://opensource.org/licenses/gpl-2.0.php',
461
gpl3 => 'http://opensource.org/licenses/gpl-3.0.html',
462
mit => 'http://opensource.org/licenses/mit-license.php',
463
mozilla => 'http://opensource.org/licenses/mozilla1.1.php',
464
open_source => undef,
465
unrestricted => undef,
466
restrictive => undef,
472
return $self->{values}->{license} unless @_;
473
my $license = shift or die(
474
'Did not provide a value to license()'
476
$license = __extract_license($license) || lc $license;
477
$self->{values}->{license} = $license;
479
# Automatically fill in license URLs
480
if ( $license_urls{$license} ) {
481
$self->resources( license => $license_urls{$license} );
482
487
sub _extract_license {
485
490
return __extract_license(
486
491
($matched) = $pod =~ m/
487
(=head \d \s+ (?:licen[cs]e|licensing)\b.*?)
492
(=head \d \s+ L(?i:ICEN[CS]E|ICENSING)\b.*?)
488
493
(=head \d.*|=cut.*|)\z
490
495
) || __extract_license(
491
496
($matched) = $pod =~ m/
492
(=head \d \s+ (?:copyrights?|legal)\b.*?)
497
(=head \d \s+ (?:C(?i:OPYRIGHTS?)|L(?i:EGAL))\b.*?)
493
498
(=head \d.*|=cut.*|)\z
498
503
sub __extract_license {
499
504
my $license_text = shift or return;
501
'under the same (?:terms|license) as (?:perl|the perl programming language)' => 'perl', 1,
502
'under the terms of (?:perl|the perl programming language) itself' => 'perl', 1,
503
'Artistic and GPL' => 'perl', 1,
504
'GNU general public license' => 'gpl', 1,
505
'GNU public license' => 'gpl', 1,
506
'GNU lesser general public license' => 'lgpl', 1,
507
'GNU lesser public license' => 'lgpl', 1,
508
'GNU library general public license' => 'lgpl', 1,
509
'GNU library public license' => 'lgpl', 1,
510
'BSD license' => 'bsd', 1,
511
'Artistic license' => 'artistic', 1,
515
'Artistic' => 'artistic', 1,
517
'proprietary' => 'proprietary', 0,
506
'(?:under )?the same (?:terms|license) as (?:perl|the perl (?:\d )?programming language)' => 'perl', 1,
507
'(?:under )?the terms of (?:perl|the perl programming language) itself' => 'perl', 1,
508
'Artistic and GPL' => 'perl', 1,
509
'GNU general public license' => 'gpl', 1,
510
'GNU public license' => 'gpl', 1,
511
'GNU lesser general public license' => 'lgpl', 1,
512
'GNU lesser public license' => 'lgpl', 1,
513
'GNU library general public license' => 'lgpl', 1,
514
'GNU library public license' => 'lgpl', 1,
515
'GNU Free Documentation license' => 'unrestricted', 1,
516
'GNU Affero General Public License' => 'open_source', 1,
517
'(?:Free)?BSD license' => 'bsd', 1,
518
'Artistic license' => 'artistic', 1,
519
'Apache (?:Software )?license' => 'apache', 1,
523
'Artistic' => 'artistic', 1,
525
'Mozilla Public License' => 'mozilla', 1,
526
'Q Public License' => 'open_source', 1,
527
'OpenSSL License' => 'unrestricted', 1,
528
'SSLeay License' => 'unrestricted', 1,
529
'zlib License' => 'open_source', 1,
530
'proprietary' => 'proprietary', 0,
519
532
while ( my ($pattern, $license, $osi) = splice(@phrases, 0, 3) ) {
520
533
$pattern =~ s#\s+#\\s+#gs;