Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Software-License CPAN distribution.

Report information
The Basics
Id: 67706
Status: open
Priority: 0/
Queue: Software-License

People
Owner: Nobody in particular
Requestors: david.wheeler [...] pgexperts.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Add short_name()
Date: Fri, 22 Apr 2011 13:33:32 -0700
To: bug-software-license [...] rt.cpan.org
From: "David E. Wheeler" <david.wheeler [...] pgexperts.com>
Download (untitled) / with headers
text/plain 117b
Possible to get a short_name() method? The names can be a bit long, e.g., http://pgxn.org/dist/pgmp/ Best David
I like the idea, and will happily accept patches! -- rjbs
Download (untitled) / with headers
text/plain 111b
This feature is now implemented with new_from_short_name() released in Software::License 0.103008 All the best
Subject: Re: [rt.cpan.org #67706] Add short_name()
Date: Sun, 17 Nov 2013 11:27:17 -0800
To: bug-Software-License [...] rt.cpan.org
From: "David E. Wheeler" <dwheeler [...] cpan.org>
Download (untitled) / with headers
text/plain 1.2k
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
Download (untitled) / with headers
text/plain 166b
Yeah, when I closed the ticket about the constructor, I suggested we should next add short_name to the classes and then reimplement the constructor in terms of those.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.