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
|
Description: ensure backward compatibility
Patches done for 0.103004-2 were modified to follow upstream advices. This modification are not backward compatible. This patch provides this backward compatibility.
.
This patch should be dropped once the reverse deps are adapted to the new API.
--- a/lib/Software/License.pm
+++ b/lib/Software/License.pm
@@ -7,6 +7,8 @@
use Data::Section -setup => { header_re => qr/\A__([^_]+)__\Z/ };
use Text::Template ();
+use Software::LicenseUtils;
+
#pod =head1 SYNOPSIS
#pod
#pod my $license = Software::License::Discordian->new({
@@ -30,6 +32,12 @@
sub new {
my ($class, $arg) = @_;
+ if ($arg->{short_name}) {
+ Carp::carp "short_name parameter in Software::License->new is deprecated. Use ",
+ "Software::LicenseUtils::new_form_short_name" ;
+ return Software::LicenseUtils->new_from_short_name($arg) ;
+ }
+
Carp::croak "no copyright holder specified" unless $arg->{holder};
bless $arg => $class;
--- a/t/summary.t
+++ b/t/summary.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 13;
+use Test::More tests => 19;
# try LGP2 license
@@ -37,3 +37,18 @@
like($license->fulltext, qr/library/i, 'license text');
}
+
+# test backward compat form
+{
+my $license = Software::License->new({
+ 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');
+}
|