On Nov 17, 2013, at 8:24 AM, Dominique Dumont via RT <bug-Software-License@rt.cpan.org> wrote:
Show quoted text> This feature is now implemented with new_from_short_name() released in Software::License 0.103008
Two things:
1. new_from_short_name() does not appear to be documented:
https://metacpan.org/pod/Software::License
Oh, I see, it’s in Utils.
2. This ticket was not requesting a constructor, but an accessor.
Here's a patch demonstrating the idea:
--- a/lib/Software/License.pm
+++ b/lib/Software/License.pm
@@ -52,6 +52,21 @@ sub holder { $_[0]->{holder} }
This method returns the name of the license, suitable for shoving in the middle
of a sentence, generally with a leading capitalized "The."
+=method short_name
+
+This method returns the short name of the license, suitable for link text,
+for example.
+
+=cut
+
+sub short_name {
+ my $class = ref $_[0] || $_[0];
+ my ($name) = $class =~ /([^:]+)$/; # Grab the package name.
+ $name =~ s/(\d)_(\d)/$1.$2/g; # Use dots in versions.
+ $name =~ s/_/ /g; # Use spaces everywhere else.
+ return $name;
+}
+
=method url
This method returns the URL at which a canonical text of the license can be
Some example output:
PostgreSQL
GPL 3
Apache 2.0
Best,
David