1String::License(3) User Contributed Perl Documentation String::License(3)
2
3
4
6 String::License - detect source code license statements in a text
7 string
8
10 Version v0.0.4
11
13 use String::License;
14 use String::License::Naming::Custom;
15
16 my $string = 'Licensed under same terms as Perl itself';
17
18 my $expressed = String::License->new( string => $string );
19 my $expression = $expressed->as_text; # => "Perl"
20
21 my $desc = String::License::Naming::Custom->new;
22 my $described = String::License->new( string => $string, naming => $desc );
23 my $description = $described->as_text; # => "The Perl 5 License"
24
26 String::License identifies license statements in a string and
27 serializes them in a normalized format.
28
30 new
31 my $licensed = String::License->new( string => 'Licensed under GPLv2' );
32
33 Accepts named arguments, and constructs and returns a
34 String::License object.
35
36 The following options are recognized:
37
38 string => STRING
39 The scalar string to parse for licensing information.
40
41 naming => OBJ
42 A String::License::Naming object, used to define license naming
43 conventions.
44
45 By default uses String::License::Naming::SPDX.
46
47 Since instantiation of naming schemes is expensive, there can
48 be a significant speed boost in passing a pre-initialized
49 naming object when processing multiple strings.
50
52 as_text
53 Returns identified licensing patterns as a string, either
54 structured as SPDX License Expressions, or with scheme-less naming
55 as a short description.
56
58 Jonas Smedegaard "<dr@jones.dk>"
59
61 This program is based on the script "licensecheck" from the KDE SDK,
62 originally introduced by Stefan Westerfeld "<stefan@space.twc.de>".
63
64 Copyright © 2007, 2008 Adam D. Barratt
65
66 Copyright © 2016-2023 Jonas Smedegaard
67
68 Copyright © 2017-2022 Purism SPC
69
70 This program is free software: you can redistribute it and/or modify it
71 under the terms of the GNU Affero General Public License as published
72 by the Free Software Foundation, either version 3, or (at your option)
73 any later version.
74
75 This program is distributed in the hope that it will be useful, but
76 WITHOUT ANY WARRANTY; without even the implied warranty of
77 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
78 Affero General Public License for more details.
79
80 You should have received a copy of the GNU Affero General Public
81 License along with this program. If not, see
82 <https://www.gnu.org/licenses/>.
83
84
85
86perl v5.36.0 2023-01-29 String::License(3)