Skip to content

Feature Request: Add short_name() Accessor #78

@theory

Description

@theory

As originally described in RT-67706, it's a short display name, something like:

--- 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions