1String::License::NamingU:s:eCrusCtoonmt(r3i)buted Perl DSotcruimnegn:t:aLtiicoennse::Naming::Custom(3)
2
3
4
6 String::License::Naming - names of licenses and license naming schemes
7
9 Version v0.0.4
10
12 use String::License::Naming::Custom;
13
14 my $obj = String::License::Naming::Custom->new( schemes => [qw(spdx internal)] );
15
16 my $schemes = [ $obj->list_schemes ]; # => is_deeply [ 'spdx', 'internal' ]
17
18 my $license = [ grep { /^(Expat|Perl)$/ } $obj->list_licenses ]; # => is_deeply ['Perl']
19
20 # use and prefer Debian-specific identifiers
21 $schemes = [ $obj->add_scheme('debian') ]; # => is_deeply [ 'debian', 'spdx', 'internal' ]
22
23 $license = [ grep { /^(Expat|Perl)$/ } $obj->list_licenses ]; # => is_deeply [ 'Expat', 'Perl' ]
24
26 String::License::Naming enumerates supported licenses matching an
27 ordered set of naming schemes, or enumerates the names of supported
28 license naming schemes.
29
30 Some licenses are known by different names. E.g. the license "MIT"
31 according to SPDX is named "Expat" in Debian.
32
33 Some licenses are not always represented. E.g. "Perl" is a
34 (discouraged) license in Debian while it is a relationship of several
35 licenses with SPDX (and that expression is recommended in Debian as
36 well).
37
38 By default, licenses are matched using naming schemes "[ 'spdx',
39 'internal' ]", which lists all supported licenses, preferrably by their
40 SPDX name or as fallback by an internal name.
41
43 new
44 my $names = String::License::Naming->new;
45
46 my $spdx_names = String::License::Naming->new( schemes => ['spdx'] );
47
48 Constructs and returns a String::License::Naming object.
49
50 Takes an optional array as named argument schemes. both ordering
51 by which name licenses should be presented, and limiting which
52 licenses to cover.
53
54 When omitted, the default schemes array "[ 'spdx', 'internal' ]" is
55 used, which includes all supported licenses, and they are presented
56 by their SPDX name when defined or otherwise by a semi-stable
57 internal name.
58
59 When passing an empty array reference, all supported licenses are
60 included, presented by a semi-stable internal potentially multi-
61 word description.
62
64 add_scheme
65 Takes a string representing a license naming scheme to use, favored
66 over existing schemes in use.
67
68 Returns array of schemes in use after addition.
69
70 list_schemes
71 Returns a list of license naming schemes in use.
72
73 list_available_schemes
74 Returns a list of all license naming schemes available.
75
76 list_licenses
77 Returns a list of licensing patterns covered by this object
78 instance, each labeled by shortname according to current set of
79 schemes.
80
82 Jonas Smedegaard "<dr@jones.dk>"
83
85 Copyright © 2023 Jonas Smedegaard
86
87 This program is free software: you can redistribute it and/or modify it
88 under the terms of the GNU Affero General Public License as published
89 by the Free Software Foundation, either version 3, or (at your option)
90 any later version.
91
92 This program is distributed in the hope that it will be useful, but
93 WITHOUT ANY WARRANTY; without even the implied warranty of
94 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
95 Affero General Public License for more details.
96
97 You should have received a copy of the GNU Affero General Public
98 License along with this program. If not, see
99 <https://www.gnu.org/licenses/>.
100
101
102
103perl v5.36.0 2023-01-29String::License::Naming::Custom(3)