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
|
Description: Add debian_text method
This method returns the license summary (if available)
or the full license text.
Author: dod
--- a/lib/Software/License.pm
+++ b/lib/Software/License.pm
@@ -89,6 +89,21 @@
$self->_fill_in(uc($distro).'-SUMMARY');
}
+sub debian_text {
+ my ($self,$distro) = @_;
+ $distro ||= 'debian' ;
+
+ carp "debian_text method is deprecated. Please use summary_or_text method",
+ "from Software::LicenseMoreUtils";
+
+ my $summary_tag = uc($distro).'-SUMMARY';
+ my $fill_in_tag
+ = $self->section_data($summary_tag) ? $summary_tag
+ : 'LICENSE' ;
+
+ $self->_fill_in($fill_in_tag);
+}
+
#pod =method license
#pod
#pod This method returns the full text of the license.
@@ -308,6 +323,13 @@
will be removed in Debian Buster. Please use
L<Software::LicenseMoreUtils>)
+=head2 debian_text
+
+This method returns a summary of the license (if available) or the full text
+of the license (Available only on Debian. This method is deprecated and
+will be removed in Debian Buster. Please use C<summary_or_text> method on
+L<Software::LicenseMoreUtils>)
+
=head2 license
This method returns the full text of the license.
--- /dev/null
+++ b/t/debian-text.t
@@ -0,0 +1,29 @@
+#!perl
+use strict;
+use warnings;
+
+use Test::More tests => 3;
+
+# try LGP2 license
+
+my $class = 'Software::LicenseUtils';
+require_ok($class);
+
+{
+ my $license = $class->new_from_short_name({
+ short_name => 'LGPL-2',
+ holder => 'X. Ample'
+ });
+
+ like($license->debian_text, qr/common-licenses/i, 'summary found');
+
+}
+{
+ my $license = $class->new_from_short_name({
+ short_name => 'Expat',
+ holder => 'X. Ample'
+ });
+
+ like($license->debian_text, qr/substantial/i, 'license text found');
+
+}
|