File Coverage

blib/lib/Pod/Weaver/Section/Author/HAYOBAAN/Bugs.pm
Criterion Covered Total %
statement 14 28 50.0
branch 1 10 10.0
condition 0 3 0.0
subroutine 5 5 100.0
pod 0 1 0.0
total 20 47 42.5


line stmt bran cond sub pod time code
1             package Pod::Weaver::Section::Author::HAYOBAAN::Bugs;
2 1     1   643147 use strict;
  1         6  
  1         35  
3 1     1   5 use warnings;
  1         2  
  1         51  
4              
5             # ABSTRACT: Improved version of Pod::Weaver::Section::Bugs, adds proper links to the BUGS pod section
6             our $VERSION = '0.013'; # VERSION
7              
8 1     1   6 use Moose;
  1         2  
  1         10  
9 1     1   6678 use namespace::autoclean;
  1         5  
  1         14  
10             with 'Pod::Weaver::Role::Section';
11              
12             #pod =head1 OVERVIEW
13             #pod
14             #pod Just like the original L<Section::Bugs|Pod::Weaver::Section::Bugs>
15             #pod plugin, this section plugin will produce a hunk of Pod giving bug
16             #pod reporting information for the document. However, instead of a
17             #pod text-only link, this plugin will create a proper, clickable, link.
18             #pod
19             #pod =head1 USAGE
20             #pod
21             #pod Add the following line to your F<weaver.ini>:
22             #pod
23             #pod [Author::HAYOBAAN::Bugs]
24             #pod
25             #pod =head1 SEE ALSO
26             #pod
27             #pod =for :list
28             #pod * The original L<Section::Bugs|Pod::Weaver::Section::Bugs> plugin.
29             #pod
30             #pod =cut
31              
32             #pod =attr header
33             #pod
34             #pod The title of the header to be added.
35             #pod
36             #pod Default: C<BUGS>
37             #pod
38             #pod =cut
39              
40             has header => (
41             is => 'ro',
42             isa => 'Str',
43             default => 'BUGS',
44             );
45              
46             #pod =for Pod::Coverage weave_section
47             #pod
48             #pod =cut
49              
50             sub weave_section {
51 1     1 0 23642 my ($self, $document, $input) = @_;
52              
53 1 50       8 return unless exists $input->{distmeta}{resources}{bugtracker};
54              
55 0           my $bugtracker = $input->{distmeta}{resources}{bugtracker};
56 0           my ($web,$mailto) = @{$bugtracker}{qw/web mailto/};
  0            
57 0 0 0       return unless defined $web || defined $mailto;
58              
59 0           my $text = "Please report any bugs or feature requests ";
60              
61 0 0         if (defined $web) {
62 0           $text .= "on the bugtracker\nL<website|$web>";
63 0 0         $text .= defined $mailto ? "\n or " : ".\n";
64             }
65              
66 0 0         if (defined $mailto) {
67 0           $text .= "by L<email|mailto:$mailto>.\n";
68             }
69              
70 0           $text .= <<'HERE';
71              
72             When submitting a bug or request, please include a test-file or a
73             patch to an existing test-file that illustrates the bug or desired
74             feature.
75             HERE
76              
77 0           push @{ $document->children },
  0            
78             Pod::Elemental::Element::Nested->new({
79             command => 'head1',
80             content => $self->header,
81             children => [
82             Pod::Elemental::Element::Pod5::Ordinary->new({ content => $text }),
83             ],
84             });
85              
86 0           return;
87             }
88              
89             __PACKAGE__->meta->make_immutable;
90             1;
91              
92             __END__
93              
94             =pod
95              
96             =encoding UTF-8
97              
98             =head1 NAME
99              
100             Pod::Weaver::Section::Author::HAYOBAAN::Bugs - Improved version of Pod::Weaver::Section::Bugs, adds proper links to the BUGS pod section
101              
102             =head1 VERSION
103              
104             version 0.013
105              
106             =head1 OVERVIEW
107              
108             Just like the original L<Section::Bugs|Pod::Weaver::Section::Bugs>
109             plugin, this section plugin will produce a hunk of Pod giving bug
110             reporting information for the document. However, instead of a
111             text-only link, this plugin will create a proper, clickable, link.
112              
113             =head1 USAGE
114              
115             Add the following line to your F<weaver.ini>:
116              
117             [Author::HAYOBAAN::Bugs]
118              
119             =head1 ATTRIBUTES
120              
121             =head2 header
122              
123             The title of the header to be added.
124              
125             Default: C<BUGS>
126              
127             =for Pod::Coverage weave_section
128              
129             =head1 BUGS
130              
131             Please report any bugs or feature requests on the bugtracker
132             L<website|https://github.com/HayoBaan/Dist-Zilla-PluginBundle-Author-HAYOBAAN/issues>.
133              
134             When submitting a bug or request, please include a test-file or a
135             patch to an existing test-file that illustrates the bug or desired
136             feature.
137              
138             =head1 SEE ALSO
139              
140             =over 4
141              
142             =item *
143              
144             The original L<Section::Bugs|Pod::Weaver::Section::Bugs> plugin.
145              
146             =back
147              
148             =head1 AUTHOR
149              
150             Hayo Baan <info@hayobaan.com>
151              
152             =head1 COPYRIGHT AND LICENSE
153              
154             This software is copyright (c) 2014 by Hayo Baan.
155              
156             This is free software; you can redistribute it and/or modify it under
157             the same terms as the Perl 5 programming language system itself.
158              
159             =cut