> Seems like it stumbles over the array; > print "META says: ", Dumper $self->meta->{license}; > outputs: > > META says: $VAR1 = [ > 'perl_5' > ]; > > > Changing > > if ( $self->meta->{license} and $self->meta->{license} =~ /perl/i > > to > > if ( $self->meta->{license} and $self->meta->{license} ~~ /perl/i > > works in this case (lib/DhMakePerl/Command/Packaging.pm, line 1065). > > Not sure about any side effects, in theory it should work for both > scalars and arrays, and smart matching exists since 5.10 ...
It stumbles on other licenses as well. According to CPAN::Meta:Spec the licenses attribute is always an array, and might contain more than one license: license Example: license => [ 'perl_5' ] license => [ 'apache_2', 'mozilla_1_0' ] (Spec 2) [required] {List of one or more License Strings} I've attached a patch to treat $self->meta->{license} as an ARRAY and loop over it. While on it, I did also add support for some other licenses as well (beyond 'perl'). -- Pelle "D’ä e å, vett ja”, skrek ja, för ja ble rasen, ”å i åa ä e ö, hörer han lite, d’ä e å, å i åa ä e ö" - Gustav Fröding, 1895
From 86a4b842c37b54f0157f9aabfc7cc08ea6bb1c03 Mon Sep 17 00:00:00 2001 From: Per Carlson <pe...@hemmop.com> Date: Fri, 16 Mar 2012 11:12:04 +0100 Subject: [PATCH] License attribute from META file is array. --- lib/DhMakePerl/Command/Packaging.pm | 29 +++++++++++++++++++++++------ 1 files changed, 23 insertions(+), 6 deletions(-) diff --git a/lib/DhMakePerl/Command/Packaging.pm b/lib/DhMakePerl/Command/Packaging.pm index 596104b..442bf65 100644 --- a/lib/DhMakePerl/Command/Packaging.pm +++ b/lib/DhMakePerl/Command/Packaging.pm @@ -2,6 +2,7 @@ package DhMakePerl::Command::Packaging; use strict; use warnings; +use feature 'switch'; =head1 NAME @@ -1062,13 +1063,29 @@ sub create_copyright { # mind that many licenses are not meant to be used as # templates (i.e. you must add the author name and some # information within the licensing text as such). - if ( $self->meta->{license} and $self->meta->{license} =~ /perl/i - or $mangle_cprt =~ /terms\s*as\s*Perl\s*itself/is ) - { - $licenses{'GPL-1+'} = 1; - $licenses{'Artistic'} = 1; - } + if ( $self->meta->{license} ) { + foreach ( @{ $self->meta->{license} }) { + given ($_) { + when (/apache_2_0/) { $licenses{'Apache-2.0'} = 1; } + when (/artistic_1/) { $licenses{'Artistic'} = 1; } + when (/artistic_2/) { $licenses{'Artistic-2.0'} = 1; } + # EU::MM and M::B converts the unversioned 'gpl' to gpl_1. + # As a unversioned GPL means *any* GPL,I think it's safe to use GPL-1+ here + when (/gpl_1/) { $licenses{'GPL-1+'} = 1; } + + when (/perl_5/) { + $licenses{'GPL-1+'} = 1; + $licenses{'Artistic'} = 1; + } + } + } + } else { + if ( $mangle_cprt =~ /terms\s*as\s*Perl\s*itself/is ) { + $licenses{'GPL-1+'} = 1; + $licenses{'Artistic'} = 1; + } + if ( $mangle_cprt =~ /[^L]GPL/ ) { if ( $mangle_cprt =~ /GPL.*version\s*1.*later\s+version/is ) { $licenses{'GPL-1+'} = 1; -- 1.7.9.1