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