File Coverage

lib/Pod/Weaver/PluginBundle/Author/AJNN/Author.pm
Criterion Covered Total %
statement 25 26 96.1
branch 2 4 50.0
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 35 39 89.7


line stmt bran cond sub pod time code
1 3     3   1845 use 5.026;
  3         18  
2 3     3   20 use warnings;
  3         19  
  3         230  
3              
4             package Pod::Weaver::PluginBundle::Author::AJNN::Author;
5             # ABSTRACT: Pod section naming the author
6             $Pod::Weaver::PluginBundle::Author::AJNN::Author::VERSION = '0.05';
7              
8 3     3   25 use Carp qw(croak);
  3         18  
  3         207  
9 3     3   632 use Moose;
  3         476393  
  3         25  
10 3     3   22889 use namespace::autoclean;
  3         8488  
  3         20  
11 3     3   754 use Pod::Elemental::Element::Nested;
  3         268755  
  3         117  
12 3     3   714 use Pod::Elemental::Element::Pod5::Ordinary;
  3         82100  
  3         816  
13              
14             with 'Pod::Weaver::Role::Section';
15              
16              
17             our $HEADER = 'AUTHOR';
18              
19              
20             sub weave_section {
21 3     3 0 56268 my ($self, $document, $input) = @_;
22            
23 3         13 my $author = $input->{authors}->[0];
24            
25 3 50       17 croak "Unsupported declaration of multiple authors in dist.ini" if $input->{authors}->@* > 1;
26              
27 3 50       18 if ( $author =~ m/<ajnn\@cpan\.org>/ ) {
28 0         0 $author .= <<~END;
29             \n
30             If you contact me by email, please make sure you include the word
31             "Perl" in your subject header to help beat the spam filters.
32             END
33             }
34            
35 3         129 push $document->children->@*, Pod::Elemental::Element::Nested->new({
36             command => 'head1',
37             content => $HEADER,
38             children => [ Pod::Elemental::Element::Pod5::Ordinary->new({
39             content => $author,
40             })],
41             });
42             }
43              
44              
45             __PACKAGE__->meta->make_immutable;
46              
47             1;
48              
49             __END__
50              
51             =pod
52              
53             =encoding UTF-8
54              
55             =head1 NAME
56              
57             Pod::Weaver::PluginBundle::Author::AJNN::Author - Pod section naming the author
58              
59             =head1 VERSION
60              
61             version 0.05
62              
63             =head1 SYNOPSIS
64              
65             package Pod::Weaver::PluginBundle::Author::AJNN;
66            
67             use Pod::Weaver::PluginBundle::Author::AJNN::Author;
68            
69             sub mvp_bundle_config {
70             return (
71             ...,
72             [ '@AJNN/Author', __PACKAGE__ . '::Author', {}, ],
73             )
74             }
75              
76             =head1 DESCRIPTION
77              
78             This package provides AJNN's customised author statement.
79              
80             In particular, if AJNN is declared as a distribution's only author,
81             a note is added that may help spam filtering.
82              
83             =head1 BUGS
84              
85             Multiple authors are unsupported.
86              
87             =head1 SEE ALSO
88              
89             L<Pod::Weaver::PluginBundle::Author::AJNN>
90              
91             L<Pod::Weaver::Section::Authors>
92              
93             =head1 AUTHOR
94              
95             Arne Johannessen <ajnn@cpan.org>
96              
97             If you contact me by email, please make sure you include the word
98             "Perl" in your subject header to help beat the spam filters.
99              
100             =head1 COPYRIGHT AND LICENSE
101              
102             Arne Johannessen has dedicated the work to the Commons by waiving all of his
103             or her rights to the work worldwide under copyright law and all related or
104             neighboring legal rights he or she had in the work, to the extent allowable by
105             law.
106              
107             Works under CC0 do not require attribution. When citing the work, you should
108             not imply endorsement by the author.
109              
110             =cut