Commit 8fd0cf77 authored by Dominique Dumont's avatar Dominique Dumont

added a method to get text for debian: summary or full text

parent dfd446ef
--- a/lib/Software/License.pm
+++ b/lib/Software/License.pm
@@ -82,6 +82,18 @@
$self->_fill_in(uc($distro).'-SUMMARY');
}
+sub debian_text {
+ my ($self,$distro) = @_;
+ $distro ||= 'debian' ;
+
+ 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.
--- /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');
+
+}
......@@ -11,4 +11,5 @@ summary_test
add_or_later_clause
backward-compat
add-expat-short-name
add-debian-text-method
short-name-fallback
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment