1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
Description: add or_later license parameter
--- a/lib/Software/License.pm
+++ b/lib/Software/License.pm
@@ -156,9 +156,11 @@
Carp::confess "couldn't build $which section" unless
my $template = $self->section_data($which);
+ my $later_text = $self->{or_later} ? ", or (at\nyour option) any later version" : '';
+
return Text::Template->fill_this_in(
$$template,
- HASH => { self => \$self },
+ HASH => { self => \$self, or_later_clause => $later_text },
DELIMITERS => [ qw({{ }}) ],
);
}
--- a/lib/Software/LicenseUtils.pm
+++ b/lib/Software/LicenseUtils.pm
@@ -183,6 +183,13 @@
'Artistic' => 'Software::License::Artistic_1_0',
'Artistic-1' => 'Software::License::Artistic_1_0',
'Artistic-2' => 'Software::License::Artistic_2_0',
+ 'GPL-1+' => [ 'Software::License::GPL_1', or_later => 1 ],
+ 'GPL-2+' => [ 'Software::License::GPL_2', or_later => 1 ],
+ 'GPL-3+' => [ 'Software::License::GPL_3', or_later => 1 ],
+ 'LGPL-2+' => [ 'Software::License::LGPL_2', or_later => 1 ],
+ 'LGPL-2.1+' => [ 'Software::License::LGPL_2_1', or_later => 1 ],
+ 'LGPL-3+' => [ 'Software::License::LGPL_3_0', or_later => 1 ],
+ 'LGPL-3.0+' => [ 'Software::License::LGPL_3_0', or_later => 1 ],
);
#pod =method new_from_short_name
@@ -207,10 +214,12 @@
Carp::croak "Unknow license with short name $short"
unless $short_name{$short};
- my $lic_file = my $lic_class = $short_name{$short} ;
+ my $info = $short_name{$short} ;
+ my @infos = ref $info ? @$info : ($info);
+ my $lic_file = my $lic_class = shift @infos;
$lic_file =~ s!::!/!g;
require "$lic_file.pm";
- return $lic_class->new( $arg );
+ return $lic_class->new( { %$arg, @infos } );
}
1;
--- a/t/summary.t
+++ b/t/summary.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 13;
# try LGP2 license
@@ -18,6 +18,21 @@
is($license->holder, 'X. Ample', '(c) holder');
isa_ok($license,'Software::License::LGPL_2',"license class");
like($license->summary, qr/common-licenses/i, 'common-licenses found');
+unlike($license->summary, qr/later version/i, 'later version clause not included');
+like($license->name, qr/version 2/i, "license name");
+like($license->fulltext, qr/library/i, 'license text');
+
+}
+{
+my $license = $class->new_from_short_name({
+ short_name => 'LGPL-2+',
+ holder => 'X. Ample'
+});
+
+is($license->holder, 'X. Ample', '(c) holder');
+isa_ok($license,'Software::License::LGPL_2',"license class");
+like($license->summary, qr/common-licenses/i, 'common-licenses found');
+like($license->summary, qr/later version/i, 'later version clause found');
like($license->name, qr/version 2/i, "license name");
like($license->fulltext, qr/library/i, 'license text');
|