1String::Copyright(3) User Contributed Perl Documentation String::Copyright(3)
2
3
4
6 String::Copyright - Representation of text-based copyright statements
7
9 Version 0.003013
10
12 use String::Copyright;
13
14 my $copyright = copyright(<<'END');
15 copr. © 1999,2000 Foo Barbaz <fb@acme.corp> and Acme Corp.
16 Copyright (c) 2001,2004 Foo (work address) <foo@zorg.corp>
17 Copyright 2003, Foo B. and friends
18 © 2000, 2002 Foo Barbaz <foo@bar.baz>
19 END
20
21 print $copyright;
22
23 # Copyright 1999-2000 Foo Barbaz <fb@acme.com> and Acme Corp.
24 # Copyright 2000, 2002 Foo Barbaz and Acme Corp.
25 # Copyright 2001, 2004 Foo (work address) <foo@zorg.org>
26 # Copyright 2003 Foo B. and friends
27
29 String::Copyright identifies copyright statements in a string and
30 serializes them in a normalized format.
31
33 Options can be set as an argument to the 'use' statement.
34
35 threshold, threshold_before, threshold_after
36 use String::Copyright { threshold_after => 5 };
37
38 Stop parsing after this many lines whithout copyright information,
39 before or after having found any copyright information at all.
40 "threshold" sets both "threshold_before" and "threshold_after".
41
42 By default unset: All lines are parsed.
43
44 format( \&sub )
45 use String::Copyright { format => \&GNU_style } };
46
47 sub GNU_style {
48 my ( $years, $owners ) = @_;
49
50 return 'Copyright (C) ' . join ' ', $years || '', $owners || '';
51 }
52
54 Exports one function: "copyright". This module uses Exporter::Tiny to
55 export functions, which allows for flexible import options; see the
56 Exporter::Tiny documentation for details.
57
59 • Encode
60
61 • Exporter::Tiny
62
64 String::Copyright operates on strings, not bytes. Data encoded as
65 UTF-8, Latin1 or other formats need to be decoded to strings before
66 use.
67
68 Only ASCII characters and © (copyright sign) are directly processed.
69
70 If copyright sign is mis-detected or accents or multi-byte characters
71 display wrong, then most likely the data was not decoded into a string.
72
73 If ranges or lists of years are not tidied, then maybe it contained
74 non-ASCII whitespace or digits.
75
77 Jonas Smedegaard "<dr@jones.dk>"
78
80 This program is based on the script "licensecheck" from the KDE SDK,
81 originally introduced by Stefan Westerfeld "<stefan@space.twc.de>".
82
83 Copyright © 2007, 2008 Adam D. Barratt
84
85 Copyright © 2005-2012, 2016, 2018, 2020-2021 Jonas Smedegaard
86
87 Copyright © 2018, 2020-2021 Purism SPC
88
89 This program is free software: you can redistribute it and/or modify it
90 under the terms of the GNU Affero General Public License as published
91 by the Free Software Foundation, either version 3, or (at your option)
92 any later version.
93
94 This program is distributed in the hope that it will be useful, but
95 WITHOUT ANY WARRANTY; without even the implied warranty of
96 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
97 Affero General Public License for more details.
98
99 You should have received a copy of the GNU Affero General Public
100 License along with this program. If not, see
101 <https://www.gnu.org/licenses/>.
102
103
104
105perl v5.36.0 2022-07-22 String::Copyright(3)