File Coverage

blib/lib/Software/License/GPL_3/or_later.pm
Criterion Covered Total %
statement 36 36 100.0
branch 2 2 100.0
condition 6 6 100.0
subroutine 14 14 100.0
pod 7 7 100.0
total 65 65 100.0


line stmt bran cond sub pod time code
1             # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
2             #
3             # file: lib/Software/License/GPL_3/or_later.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 .
19             #
20             # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21              
22             #tt
23             #tt
24             #tt
25             #tt
26             #tt
27             #tt
28             #tt
29             #tt
30             #tt
31             #tt
32             #tt
33             #tt
34             #tt
35             #tt
36             #tt
37             #tt
38             #tt
39              
40              
41             #pod =for :this This is C module documentation. Read this if you
42             #pod are going to hack or extend the module, or use the module directly.
43             #pod
44             #pod =for :those If you want to use GNU license with "or later" clause read the L
45             #pod manual|Software::License::OrLaterPack>. General topics like getting source, building, installing,
46             #pod bug reporting and some others are covered in the F file.
47             #pod
48             #pod =head1 SYNOPSIS
49             #pod
50             #pod my $lic = Software::License::GPL_3::or_later->new( {
51             #pod holder => 'John Doe',
52             #pod year => '2010',
53             #pod program => 'Assa'
54             #pod } );
55             #pod
56             #pod $lic->_abbr; # 'GPL'
57             #pod $lic->abbr; # 'GPLv3+'
58             #pod $lic->_name; # 'GNU General Public License'
59             #pod $lic->name; # 'The GNU General Public License version 3 or later'
60             #pod
61             #pod $lic->notice;
62             #pod # Copyright statement and
63             #pod # standard GNU 3-paragraph license notice.
64             #pod $lic->notice( 'short' );
65             #pod # Copyright statement, license name and
66             #pod # two sentences about free software and warranties.
67             #pod
68             #pod # …and other methods inherited from Software::License::GPL_3
69             #pod # and Software::License.
70             #pod
71             #pod =head1 DESCRIPTION
72             #pod
73             #pod C is a subclass of C.
74             #pod It overrides few parent methods and introduces few own methods.
75             #pod
76             #pod See documentation on L for a general description of the class interface.
77             #pod
78             #pod =cut
79              
80             package Software::License::GPL_3::or_later;
81              
82 1     1   2184 use strict;
  1         2  
  1         22  
83 1     1   3 use warnings;
  1         1  
  1         21  
84 1     1   2 use version 0.77;
  1         19  
  1         5  
85              
86             # ABSTRACT: GPLv3+ license for Software::License infrastructure
87             our $VERSION = 'v0.10.2'; # VERSION
88              
89 1     1   61 use parent 'Software::License::GPL_3';
  1         2  
  1         3  
90 1     1   50 use Text::Wrap;
  1         1  
  1         358  
91              
92             #pod =attr _abbr
93             #pod
94             #pod Bare abbreviated license name, "GPL".
95             #pod
96             #pod Note: this attribute is I inherited from the base class.
97             #pod
98             #pod =cut
99              
100             sub _abbr {
101 3     3   1105 return 'GPL';
102             };
103              
104             #pod =attr abbr
105             #pod
106             #pod Abbreviated license name: concatenated bare abbreviated license name, 'v' character, and license
107             #pod version (with trailing plus sign).
108             #pod
109             #pod Note: this attribute is I inherited from the base class.
110             #pod
111             #pod =cut
112              
113             sub abbr {
114 2     2 1 611 my ( $self ) = @_;
115 2         5 return $self->_abbr . 'v' . $self->version;
116             };
117              
118             #pod =attr base
119             #pod
120             #pod A reference to base license object, i. e. license without "or later" clause.
121             #pod
122             #pod Note: this attribute is I inherited from the base class.
123             #pod
124             #pod =cut
125              
126             sub base {
127 10     10 1 554 my ( $self ) = @_;
128 10 100       30 if ( not $self->{ base } ) {
129 1         3 my %base = %$self; # Create a copy, because `new` (re)blesses passed `HashRef`.
130 1         4 $self->{ base } = Software::License::GPL_3->new( \%base );
131             };
132 10         33 return $self->{ base };
133             };
134              
135             #pod =attr _name
136             #pod
137             #pod Bare name of the license, which is also bare name of the base license, because it does
138             #pod include neither definitive article ("The"), nor license version nor "or later" clause:
139             #pod "GNU General Public License".
140             #pod
141             #pod Note: this attribute is I inherited from the base class.
142             #pod
143             #pod =cut
144              
145             sub _name {
146 15     15   904 return 'GNU General Public License';
147             };
148              
149             #pod =attr name
150             #pod
151             #pod This attribute meets C specification: returned name starts with definitive
152             #pod capitalized article ("The"). Returned name also includes the base license version (like other
153             #pod C classes do) (without trailing plus sign) and "or later" clause.
154             #pod
155             #pod =cut
156              
157             sub name {
158 2     2 1 63 my ( $self ) = @_;
159 2         5 return sprintf( "The %s version %s or later", $self->_name, $self->base->version );
160             };
161              
162             #pod =attr program
163             #pod
164             #pod A program name as specified by the C option in constructor, or the C option in
165             #pod constructor, or "this program". This form of program name is intended to be used in the middle of
166             #pod sentence.
167             #pod
168             #pod Note: this attribute is I inherited from the base class.
169             #pod
170             #pod =cut
171              
172             sub program {
173 8     8 1 880 my ( $self ) = @_;
174 8   100     45 return $self->{ program } || $self->{ Program } || 'this program';
175             };
176              
177             #pod =attr Program
178             #pod
179             #pod A program name as specified by the C option in constructor, or the C option in
180             #pod constructor, or "This program". This form of program name is intended to be used in the beginning
181             #pod of sentence.
182             #pod
183             #pod Note: this attribute is I inherited from the base class.
184             #pod
185             #pod =cut
186              
187             sub Program {
188 12     12 1 26142 my ( $self ) = @_;
189 12   100     81 return $self->{ Program } || $self->{ program } || 'This program';
190             };
191              
192             #pod =method notice
193             #pod
194             #pod This method overrides L's C. Differences are:
195             #pod
196             #pod =for :list
197             #pod * If the license object was created with C or C or both options, notice will
198             #pod include real program name instead of generic "this program".
199             #pod * It returns copyright statement followed by standard GNU 3-paragraph license notice.
200             #pod * Result is formatted with L.
201             #pod
202             #pod The method can be called with C<'short'> argument to get short version of notice. Short version
203             #pod includes: copyright statement, license name, and two sentences about free software and warranties.
204             #pod Note: This is experimental feature.
205             #pod
206             #pod =cut
207              
208             sub notice {
209 5     5 1 1842 my ( $self, $arg ) = @_;
210 5   100     30 my $notice = Text::Wrap::fill( '', '', $self->_fill_in( $arg || 'NOTICE' ) );
211             # Documentation on `fill` says it deletes all trailing whitespace, but it looks like it
212             # may leave one space. Let us make sure notice ends with one newline.
213 5         5167 $notice =~ s{\s*\z}{\n}x;
214 5         385 return $notice;
215             };
216              
217             #pod =attr version
218             #pod
219             #pod License version (base license version with appended plus sign to denote "or later" clause).
220             #pod
221             #pod =cut
222              
223             sub version {
224 3     3 1 351 my ( $self ) = @_;
225 3         5 return $self->base->version . '+';
226             };
227              
228             1;
229              
230             #pod =head1 COPYRIGHT AND LICENSE
231             #pod
232             #pod Copyright (C) 2015 Van de Bugger
233             #pod
234             #pod License GPLv3+: The GNU General Public License version 3 or later
235             #pod .
236             #pod
237             #pod This is free software: you are free to change and redistribute it. There is
238             #pod NO WARRANTY, to the extent permitted by law.
239             #pod
240             #pod
241             #pod =cut
242              
243             # doc/what.pod #
244              
245             #pod =encoding UTF-8
246             #pod
247             #pod =head1 WHAT?
248             #pod
249             #pod C (or just C for brevity) is an add-on for C, a set
250             #pod of licenses with "or later" clause (like C). It allows Perl developers (who use
251             #pod C) to release their work under the terms of a I version I or (at user
252             #pod option) any later version.
253             #pod
254             #pod =cut
255              
256             # end of file #
257              
258             =pod
259              
260             =encoding UTF-8
261              
262             =head1 NAME
263              
264             Software::License::GPL_3::or_later - GPLv3+ license for Software::License infrastructure
265              
266             =head1 VERSION
267              
268             Version v0.10.2, released on 2016-10-10 22:17 UTC.
269              
270             =head1 WHAT?
271              
272             C (or just C for brevity) is an add-on for C, a set
273             of licenses with "or later" clause (like C). It allows Perl developers (who use
274             C) to release their work under the terms of a I version I or (at user
275             option) any later version.
276              
277             This is C module documentation. Read this if you
278             are going to hack or extend the module, or use the module directly.
279              
280             If you want to use GNU license with "or later" clause read the L
281             manual|Software::License::OrLaterPack>. General topics like getting source, building, installing,
282             bug reporting and some others are covered in the F file.
283              
284             =head1 SYNOPSIS
285              
286             my $lic = Software::License::GPL_3::or_later->new( {
287             holder => 'John Doe',
288             year => '2010',
289             program => 'Assa'
290             } );
291              
292             $lic->_abbr; # 'GPL'
293             $lic->abbr; # 'GPLv3+'
294             $lic->_name; # 'GNU General Public License'
295             $lic->name; # 'The GNU General Public License version 3 or later'
296              
297             $lic->notice;
298             # Copyright statement and
299             # standard GNU 3-paragraph license notice.
300             $lic->notice( 'short' );
301             # Copyright statement, license name and
302             # two sentences about free software and warranties.
303              
304             # …and other methods inherited from Software::License::GPL_3
305             # and Software::License.
306              
307             =head1 DESCRIPTION
308              
309             C is a subclass of C.
310             It overrides few parent methods and introduces few own methods.
311              
312             See documentation on L for a general description of the class interface.
313              
314             =head1 OBJECT ATTRIBUTES
315              
316             =head2 _abbr
317              
318             Bare abbreviated license name, "GPL".
319              
320             Note: this attribute is I inherited from the base class.
321              
322             =head2 abbr
323              
324             Abbreviated license name: concatenated bare abbreviated license name, 'v' character, and license
325             version (with trailing plus sign).
326              
327             Note: this attribute is I inherited from the base class.
328              
329             =head2 base
330              
331             A reference to base license object, i. e. license without "or later" clause.
332              
333             Note: this attribute is I inherited from the base class.
334              
335             =head2 _name
336              
337             Bare name of the license, which is also bare name of the base license, because it does
338             include neither definitive article ("The"), nor license version nor "or later" clause:
339             "GNU General Public License".
340              
341             Note: this attribute is I inherited from the base class.
342              
343             =head2 name
344              
345             This attribute meets C specification: returned name starts with definitive
346             capitalized article ("The"). Returned name also includes the base license version (like other
347             C classes do) (without trailing plus sign) and "or later" clause.
348              
349             =head2 program
350              
351             A program name as specified by the C option in constructor, or the C option in
352             constructor, or "this program". This form of program name is intended to be used in the middle of
353             sentence.
354              
355             Note: this attribute is I inherited from the base class.
356              
357             =head2 Program
358              
359             A program name as specified by the C option in constructor, or the C option in
360             constructor, or "This program". This form of program name is intended to be used in the beginning
361             of sentence.
362              
363             Note: this attribute is I inherited from the base class.
364              
365             =head2 version
366              
367             License version (base license version with appended plus sign to denote "or later" clause).
368              
369             =head1 OBJECT METHODS
370              
371             =head2 notice
372              
373             This method overrides L's C. Differences are:
374              
375             =over 4
376              
377             =item *
378              
379             If the license object was created with C or C or both options, notice will include real program name instead of generic "this program".
380              
381             =item *
382              
383             It returns copyright statement followed by standard GNU 3-paragraph license notice.
384              
385             =item *
386              
387             Result is formatted with L.
388              
389             =back
390              
391             The method can be called with C<'short'> argument to get short version of notice. Short version
392             includes: copyright statement, license name, and two sentences about free software and warranties.
393             Note: This is experimental feature.
394              
395             =head1 AUTHOR
396              
397             Van de Bugger
398              
399             =head1 COPYRIGHT AND LICENSE
400              
401             Copyright (C) 2015 Van de Bugger
402              
403             License GPLv3+: The GNU General Public License version 3 or later
404             .
405              
406             This is free software: you are free to change and redistribute it. There is
407             NO WARRANTY, to the extent permitted by law.
408              
409             =cut
410              
411             __DATA__