OrLaterPack.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 14 / 14 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« LGPL_3_0/or_later.pm ↑ Summary
1 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2 #
3 # file: lib/Software/License/OrLaterPack.pm
4 #
5 # Copyright © 2015 Van de Bugger
6 #
7 # This file is part of perl-Software-License-OrLaterPack.
8 #
9 # perl-Software-License-OrLaterPack is free software: you can redistribute it and/or modify it
10 # under the terms of the GNU General Public License as published by the Free Software Foundation,
11 # either version 3 of the License, or (at your option) any later version.
12 #
13 # perl-Software-License-OrLaterPack is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 # PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License along with
18 # perl-Software-License-OrLaterPack. If not, see <http://www.gnu.org/licenses/>.
19 #
20 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21  
22 # This is dummy main module of `OrLaterPack`, because CPAN does not handle well distributions
23 # without a main module. Also, it documents the distribution as a whole.
24  
25 package Software::License::OrLaterPack;
26  
27 1 ▶use strict; # Let Kwalitee be happy.
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use warnings; # Ditto.
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use version 0.77;
Subroutine BEGIN: called CC=1 SCAR=0.0
30  
31 # ABSTRACT: Use GNU license with "or later" clause
32 1 our $VERSION = 'v0.10.2'; # VERSION
33  
34 1 1;
35  
36 #pod =pod
37 #pod
38 #pod =encoding UTF-8
39 #pod
40 #pod =for :this This is C<OrLaterPack> user manual. Read this if you want to use GNU license with "or later" clause.
41 #pod
42 #pod =for :those If you are going to hack or extend C<OrLaterPack> read module documentation, e. g.
43 #pod L<Software::License::GPL_3::or_later>. General topics like getting source, building, installing,
44 #pod bug reporting and some others are covered in the F<README> file.
45 #pod
46 #pod =for comment ---------------------------------------------------------------------------------------
47 #pod
48 #pod =head1 SYNOPSIS
49 #pod
50 #pod =for test_synopsis BEGIN { die "SKIP: Not Perl code.\n" };
51 #pod # Ok, the second part is Perl code, but `Test::Synopsis` doesn't allow to check only part of
52 #pod # synopsis.
53 #pod
54 #pod In C<dist.ini>:
55 #pod
56 #pod name = Foo-Bar
57 #pod version = 0.001
58 #pod author = John Doe <john.doe@example.com>
59 #pod license = GPL_3::or_later
60 #pod ; or another license, see the list of provided licenses
61 #pod copyright_holder = John Doe
62 #pod copyright_year = 2015
63 #pod …
64 #pod
65 #pod Direct usage:
66 #pod
67 #pod use Software::License::GPL_3::or_later;
68 #pod # or another license, see the list of provided licenses
69 #pod my $lic = Software::License::GPL_3::or_later->new( {
70 #pod holder => 'John Doe',
71 #pod year => '2010',
72 #pod program => 'Assa',
73 #pod } );
74 #pod $lic->abbr; # returns 'GPLv3+'
75 #pod $lic->notice; # Copyright statement and 3-paragraph GNU license notice
76 #pod …
77 #pod
78 #pod =for comment ---------------------------------------------------------------------------------------
79 #pod
80 #pod =head1 DESCRIPTION
81 #pod
82 #pod All "or later" are just subclasses of corresponding base license classes. For example,
83 #pod C<Software::License::GPL_3::or_later> is a subclass of C<Software::License::GPL_3>, so any "or
84 #pod later" license can be used like any other license. For example, in your F<dist.ini> file:
85 #pod
86 #pod license = GPL_3::or_later
87 #pod
88 #pod However, licenses in the pack introduce few features not found in base classes.
89 #pod
90 #pod =head2 Program Name
91 #pod
92 #pod C<Software::License> constructor accepts hashref as the only argument:
93 #pod
94 #pod $lic = Software::License::GPL_3::or_later->new( {
95 #pod holder => 'John Doe',
96 #pod year => '2010',
97 #pod } );
98 #pod
99 #pod C<Software::License> documents two keys C<holder> and C<year> shown in example. However,
100 #pod C<Software::License> constructor just (re)blesses passed hashref to the package, keeping all the
101 #pod hash keys and values intact, so you can pass more arguments to the constructor.
102 #pod
103 #pod C<OrLaterPack> licenses use two more keys C<program> and C<Program>:
104 #pod
105 #pod $lic = Software::License::GPL_3::or_later->new( {
106 #pod holder => 'John Doe',
107 #pod year => '2010',
108 #pod program => 'assa',
109 #pod Program => 'Assa',
110 #pod } );
111 #pod
112 #pod These values are used as program name instead of generic "this program" in license notice, for
113 #pod example:
114 #pod
115 #pod Assa is free software: you can redistribute it and/or modify it…
116 #pod
117 #pod C<program> key is used in the middle of sentence, C<Program> is used if program name starts a
118 #pod sentence. You may specify either one or both keys. If only one key specified, it is used in all the
119 #pod occurrences regardless of its position within a sentence.
120 #pod
121 #pod Note: At time of writing, these keys are used only by licenses from C<OrLaterPack>. You can safely
122 #pod pass them to constructor of any license, it does not hurt but keys will not be used.
123 #pod
124 #pod When using C<Dist::Zilla> you just specify few options, and C<Dist::Zilla> does all the work on
125 #pod behalf of you:
126 #pod
127 #pod name = Assa
128 #pod license = GPL_3::or_later
129 #pod copyright_holder = John Doe
130 #pod copyright_year = 2010
131 #pod
132 #pod Program name is specified, but C<Dist::Zilla> does not pass it to license object constructor. Patch
133 #pod for C<Dist::Zilla> submitted but not yet applied. Meanwhile, you can hack it with little help from
134 #pod C<Hook> plugin:
135 #pod
136 #pod name = Assa
137 #pod license = GPL_3::or_later
138 #pod copyright_holder = John Doe
139 #pod copyright_year = 2010
140 #pod [Hook::Init]
141 #pod . = $dist->license->{ program } = $dist->name;
142 #pod ; Voilà: license has `program` key now.
143 #pod ...
144 #pod
145 #pod For accessing these keys, C<OrLaterPack> introduced two methods: C<program> and C<Program>. They
146 #pod are convenient because you should not worry if the key was specified or not: a method returns best
147 #pod available variant of program name. For example, if C<program> key was not passed to the
148 #pod constructor, C<< $self->{ program } >> will return C<undef>, while C<< $self->program >> will
149 #pod return value of C<Program> key, if it was specified, or "this program" as the last resort. However,
150 #pod these methods are not defined in base class and can be invoked only on a license from
151 #pod C<OrLaterPack>.
152 #pod
153 #pod =head2 Short License Notice
154 #pod
155 #pod Standard GNU license notice consists of 3 paragraphs (more than 100 words and 600 characters). It
156 #pod is ok for the program documentation, but it far too long to be printed in the beginning of
157 #pod interactive session. For latter purpose FSF recommends to use short notice like this one:
158 #pod
159 #pod Copyright (C) 2010 John Doe
160 #pod License GPLv3+: GNU General Public License version 3 or later.
161 #pod This is free software: you are free to change and redistribute it.
162 #pod There is NO WARRANTY, to the extent permitted by law.
163 #pod
164 #pod To get short license notice, pass C<'short'> argument to the C<notice> method:
165 #pod
166 #pod $lic->notice( 'short' );
167 #pod
168 #pod At time of writing, C<'short'> argument is respected only by licenses in C<orLaterPack>. Other
169 #pod licenses ignore the arguments and return ordinary license note.
170 #pod
171 #pod Note: This feature is considered experimental now.
172 #pod
173 #pod =for comment ---------------------------------------------------------------------------------------
174 #pod
175 #pod =head1 LIST OF PROVIDED LICENSES
176 #pod
177 #pod =for :list
178 #pod = L<Software::License::AGPL_3::or_later>
179 #pod = L<Software::License::GPL_1::or_later>
180 #pod = L<Software::License::GPL_2::or_later>
181 #pod = L<Software::License::GPL_3::or_later>
182 #pod = L<Software::License::LGPL_2_1::or_later>
183 #pod = L<Software::License::LGPL_3_0::or_later>
184 #pod
185 #pod
186 #pod =head1 CAVEATS
187 #pod
188 #pod L<CPAN::Meta::Spec> hardcodes the list of "valid" licenses. In version 2.150001 of the module there
189 #pod are no "upgradable" GNU licenses, so in CPAN the GPLv3+ will look as ordinal GPLv3 (C<gpl_3>), and
190 #pod so on.
191 #pod
192 #pod =for comment ---------------------------------------------------------------------------------------
193 #pod
194 #pod =head1 SEE ALSO
195 #pod
196 #pod =for :list
197 #pod = L<Dist::Zilla>
198 #pod = L<Dist::Zilla::Plugin::Hook>
199 #pod = L<Software::License>
200 #pod = L<Why should programs say “Version 3 of the GPL or any later version”?|https://www.gnu.org/licenses/gpl-faq.html#VersionThreeOrLater>
201 #pod
202 #pod =for comment ---------------------------------------------------------------------------------------
203 #pod
204 #pod =head1 COPYRIGHT AND LICENSE
205 #pod
206 #pod Copyright (C) 2015 Van de Bugger
207 #pod
208 #pod License GPLv3+: The GNU General Public License version 3 or later
209 #pod <http://www.gnu.org/licenses/gpl-3.0.txt>.
210 #pod
211 #pod This is free software: you are free to change and redistribute it. There is
212 #pod NO WARRANTY, to the extent permitted by law.
213 #pod
214 #pod
215 #pod =cut
216  
217 # doc/what.pod #
218  
219 #pod =encoding UTF-8
220 #pod
221 #pod =head1 WHAT?
222 #pod
223 #pod C<Software-License-OrLaterPack> (or just C<OrLaterPack> for brevity) is an add-on for C<Software-License>, a set
224 #pod of licenses with "or later" clause (like C<GPL_3::or_later>). It allows Perl developers (who use
225 #pod C<Dist-Zilla>) to release their work under the terms of a I<License> version I<N> or (at user
226 #pod option) any later version.
227 #pod
228 #pod =cut
229  
230 # end of file #
231 # doc/why.pod #
232  
233 #pod =encoding UTF-8
234 #pod
235 #pod =head1 WHY?
236 #pod
237 #pod C<Dist-Zilla> is a popular tool for building CPAN distributions. Build process is controlled by
238 #pod F<dist.ini>, C<Dist-Zilla> configuration file. A distribution author can specify license covering
239 #pod his work by using C<license> option in F<dist.ini> file:
240 #pod
241 #pod license = NAME
242 #pod
243 #pod where I<NAME> is a name of module from L<Software::License> hierarchy.
244 #pod
245 #pod C<Software-License> is shipped with a set of popular licenses, from C<Apache_1_1> to C<Zlib>,
246 #pod including GNU licenses (GPL), including their "Affero" and "Lesser" variants.
247 #pod
248 #pod So, if a developer wants to release his work under the terms of the GPL version 3, he should write
249 #pod in his F<dist.ini>:
250 #pod
251 #pod license = GPL_3
252 #pod
253 #pod However, L<Free Software Foundation recommends using clause "license version I<N> or (at your
254 #pod option) any later version"|https://www.gnu.org/licenses/gpl-faq.html#VersionThreeOrLater>. Unfortunately, C<Software-License> distribution
255 #pod does not supply (out of the box) a way to express such clause.
256 #pod
257 #pod C<OrLaterPack> fulfills the lack. If C<OrLaterPack> is installed, a developer can specify in his
258 #pod F<dist.ini>:
259 #pod
260 #pod license = GPL_3::or_later
261 #pod
262 #pod =cut
263  
264 # end of file #
265  
266  
267 # end of file #
268  
269 __END__
« LGPL_3_0/or_later.pm ↑ Summary