File Coverage

blib/lib/Pod/Weaver/PluginBundle/Author/AJNN/License.pm
Criterion Covered Total %
statement 28 32 87.5
branch 1 4 25.0
condition 1 3 33.3
subroutine 9 9 100.0
pod 0 2 0.0
total 39 50 78.0


line stmt bran cond sub pod time code
1 2     2   1100 use 5.026;
  2         8  
2 2     2   11 use warnings;
  2         5  
  2         104  
3              
4             # ABSTRACT: Pod section for copyright and license statement
5             $Pod::Weaver::PluginBundle::Author::AJNN::License::VERSION = '0.02';
6              
7             use Carp qw(croak);
8 2     2   13 use Moose;
  2         10  
  2         79  
9 2     2   11 use namespace::autoclean;
  2         3  
  2         12  
10 2     2   11361 use Pod::Elemental::Element::Nested;
  2         5  
  2         17  
11 2     2   545 use Pod::Elemental::Element::Pod5::Ordinary;
  2         47758  
  2         69  
12 2     2   14  
  2         5  
  2         614  
13             with 'Pod::Weaver::Role::Section';
14              
15              
16             our $HEADER = 'COPYRIGHT AND LICENSE';
17              
18              
19             my ($self, $document, $input) = @_;
20            
21 1     1 0 481 my $notice = $self->notice_maybe_mangled(
22             $input->{license},
23             $input->{authors},
24             );
25            
26 1         6 push $document->children->@*, Pod::Elemental::Element::Nested->new({
27             command => 'head1',
28 1         35 content => $HEADER,
29             children => [ Pod::Elemental::Element::Pod5::Ordinary->new({
30             content => $notice,
31             })],
32             });
33             }
34              
35              
36             my (undef, $license, $authors) = @_;
37            
38             my $notice = $license->notice;
39 2     2 0 85 $notice =~ s/^\s+//;
40             $notice =~ s/\s+$//;
41 2         16
42 2         2885 # I prefer artistic_2 because I find the perl_5 terms too limiting.
43 2         25 # At the same time, I'm aware that some people don't consider perl_5
44             # to match the definition in section (4) (c) (ii) of artistic_2.
45             # I would tend to disagree, but IANAL. To avoid any possible doubt
46             # about my intentions, I choose to explicitly offer both licenses.
47            
48             return $notice if $license->spdx_expression ne 'Artistic-2.0'
49             || $authors->[0] !~ m/<ajnn.cpan\.org>/;
50             croak "Unsupported declaration of multiple authors in dist.ini" if @$authors > 1;
51 2 50 33     25
52             $notice =~ s/This is free software, licensed under.*//s;
53 0 0         $notice .= <<END;
54             This is free software; you can redistribute it and/or modify it under
55 0           the terms of the Artistic License 2.0 or (at your option) the same terms
56 0           as the Perl 5 programming language system itself.
57             END
58             return $notice;
59             }
60              
61 0            
62             __PACKAGE__->meta->make_immutable;
63              
64             1;
65              
66              
67             =pod
68              
69             =encoding UTF-8
70              
71             =head1 NAME
72              
73             Pod::Weaver::PluginBundle::Author::AJNN::License - Pod section for copyright and license statement
74              
75             =head1 VERSION
76              
77             version 0.02
78              
79             =head1 SYNOPSIS
80              
81             package Pod::Weaver::PluginBundle::Author::AJNN;
82            
83             use Pod::Weaver::PluginBundle::Author::AJNN::License;
84            
85             sub mvp_bundle_config {
86             return (
87             ...,
88             [ '@AJNN/License', __PACKAGE__ . '::License', {}, ],
89             )
90             }
91              
92             =head1 DESCRIPTION
93              
94             This package provides AJNN's customised copyright and license statement.
95              
96             In particular, for distributions which declare their license as Artistic-2.0
97             I<and> which declare AJNN as their only author, the license statement is
98             modified to I<explicitly> allow reuse under the same terms as the S<Perl 5>
99             programming language system itself as well. Effectively, this results in
100             triple-licensing under (Artistic-2.0 OR Artistic-1.0-Perl OR GPL-1.0-or-later),
101             at the choice of the user.
102              
103             Reuse under Perl 5 terms might already be allowed under S<section (4) (c) (ii)>
104             of Artistic-2.0, but I like to state this explicitly for the avoidance of doubt.
105              
106             =head1 BUGS
107              
108             Multiple authors are unsupported.
109              
110             =head1 SEE ALSO
111              
112             L<Pod::Weaver::PluginBundle::Author::AJNN>
113              
114             L<Pod::Weaver::Section::Legal>
115              
116             =head1 AUTHOR
117              
118             Arne Johannessen <ajnn@cpan.org>
119              
120             If you contact me by email, please make sure you include the word
121             "Perl" in your subject header to help beat the spam filters.
122              
123             =head1 COPYRIGHT AND LICENSE
124              
125             Arne Johannessen has dedicated the work to the Commons by waiving all of his
126             or her rights to the work worldwide under copyright law and all related or
127             neighboring legal rights he or she had in the work, to the extent allowable by
128             law.
129              
130             Works under CC0 do not require attribution. When citing the work, you should
131             not imply endorsement by the author.
132              
133             =cut