NAME
String::License::Naming - names of licenses and license naming schemes
VERSION
Version v0.0.8
SYNOPSIS
use String::License::Naming::Custom;
my $obj = String::License::Naming::Custom->new( schemes => [qw(spdx internal)] );
my $schemes = [ $obj->list_schemes ]; # => is_deeply [ 'spdx', 'internal' ]
my $license = [ grep { /^(Expat|Perl)$/ } $obj->list_licenses ]; # => is_deeply ['Perl']
# use and prefer Debian-specific identifiers
$schemes = [ $obj->add_scheme('debian') ]; # => is_deeply [ 'debian', 'spdx', 'internal' ]
$license = [ grep { /^(Expat|Perl)$/ } $obj->list_licenses ]; # => is_deeply [ 'Expat', 'Perl' ]
DESCRIPTION
String::License::Naming enumerates supported licenses matching an ordered set of naming schemes, or enumerates the names of supported license naming schemes.
Some licenses are known by different names. E.g. the license "MIT" according to SPDX is named "Expat" in Debian.
Some licenses are not always represented. E.g. "Perl" is a (discouraged) license in Debian while it is a relationship of several licenses with SPDX (and that expression is recommended in Debian as well).
By default, licenses are matched using naming schemes [ 'spdx', 'internal' ]
, which lists all supported licenses, preferrably by their SPDX name or as fallback by an internal name.
CONSTRUCTOR
- new
-
my $names = String::License::Naming->new; my $spdx_names = String::License::Naming->new( schemes => ['spdx'] );
Constructs and returns a String::License::Naming object.
Takes an optional array as named argument schemes. both ordering by which name licenses should be presented, and limiting which licenses to cover.
When omitted, the default schemes array
[ 'spdx', 'internal' ]
is used, which includes all supported licenses, and they are presented by their SPDX name when defined or otherwise by a semi-stable internal name.When passing an empty array reference, all supported licenses are included, presented by a semi-stable internal potentially multi-word description.
FUNCTIONS
- add_scheme
-
Takes a string representing a license naming scheme to use, favored over existing schemes in use.
Returns array of schemes in use after addition.
- list_schemes
-
Returns a list of license naming schemes in use.
- list_available_schemes
-
Returns a list of all license naming schemes available.
- list_licenses
-
Returns a list of licensing patterns covered by this object instance, each labeled by shortname according to current set of schemes.
AUTHOR
Jonas Smedegaard <dr@jones.dk>
COPYRIGHT AND LICENSE
Copyright © 2023 Jonas Smedegaard
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.