Weaver/Section/Legal.pm

filter: Statementstmt 93.9% 31 / 33 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 91.1% 41 / 45 CC 3 SCAR 5.3
CC
3
Cov
92%
weave_section
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Weaver/Section/Leftovers.pm ↑ Summary Weaver/Role/StringFromComment.pm »
1 package Pod::Weaver::Section::Legal 4.022;
2 # ABSTRACT: a section for the copyright and license
3  
4 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 with 'Pod::Weaver::Role::Section';
6  
7 # BEGIN BOILERPLATE
8 6 ▶use v5.22.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶no feature 'switch';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use experimental qw(postderef postderef_qq); # This experiment gets mainlined.
Subroutine BEGIN: called CC=1 SCAR=0.0
13 # END BOILERPLATE
14  
15 #pod =head1 OVERVIEW
16 #pod
17 #pod This section plugin will produce a hunk of Pod giving the copyright and license
18 #pod information for the document, like this:
19 #pod
20 #pod =head1 COPYRIGHT AND LICENSE
21 #pod
22 #pod This document is copyright (C) 1991, Ricardo Signes.
23 #pod
24 #pod This document is available under the blah blah blah.
25 #pod
26 #pod This plugin will do nothing if no C<license> input parameter is available. The
27 #pod C<license> is expected to be a L<Software::License> object.
28 #pod
29 #pod =cut
30  
31 #pod =attr license_file
32 #pod
33 #pod Specify the name of the license file and an extra line of text will be added
34 #pod telling users to check the file for the full text of the license.
35 #pod
36 #pod Defaults to none.
37 #pod
38 #pod =attr header
39 #pod
40 #pod The title of the header to be added.
41 #pod (default: "COPYRIGHT AND LICENSE")
42 #pod
43 #pod =cut
44  
45 6 has header => (
46 is => 'ro',
47 isa => 'Str',
48 default => 'COPYRIGHT AND LICENSE',
49 );
50  
51 6 has license_file => (
52 is => 'ro',
53 isa => 'Str',
54 predicate => '_has_license_file',
55 );
56  
57 9 ▶sub weave_section {
Subroutine weave_section: called CC=3 SCAR=11.2
Pod undocumented
58 9 my ($self, $document, $input) = @_;
59  
60 9 ▶ unless ($input->{license}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($input->{"license"}) 0 9 9
61 0 $self->log_debug('no license specified, not adding a ' . $self->header . ' section');
62 0 return;
63 }
64  
65 9 my $notice = $input->{license}->notice;
66 9 chomp $notice;
67  
68 9 ▶ if ( $self->_has_license_file ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_has_license_file) 1 8 9
69 1 $notice .= "\n\nThe full text of the license can be found in the\nF<";
70 1 $notice .= $self->license_file . "> file included with this distribution.";
71 }
72  
73 9 $self->log_debug('adding ' . $self->header . ' section');
74  
75 9 push $document->children->@*,
76 Pod::Elemental::Element::Nested->new({
77 command => 'head1',
78 content => $self->header,
79 children => [
80 Pod::Elemental::Element::Pod5::Ordinary->new({ content => $notice }),
81 ],
82 });
83 }
84  
85 6 __PACKAGE__->meta->make_immutable;
86 6 1;
87  
88 __END__
« Weaver/Section/Leftovers.pm ↑ Summary Weaver/Role/StringFromComment.pm »