Knit/Plugin/Authors.pm

filter: Statementstmt 93.3% 28 / 30 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 90.7% 39 / 43 CC 4 SCAR 6.2
CC
4
Cov
89%
munge
3.2
__ANON__
2.1
BEGIN
1.0
CRAP 1.9
« Knit/Document.pm ↑ Summary Knit/Output/Pod.pm »
1 package Pod::Knit::Plugin::Authors;
2 3 our $AUTHORITY = 'cpan:YANICK';
3 3 $Pod::Knit::Plugin::Authors::VERSION = '0.0.1';
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Web::Query;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 extends 'Pod::Knit::Plugin';
11 3 with 'Pod::Knit::DOM::WebQuery';
12  
13 3 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 has "authors" => (
16 traits => [ 'Array' ],
17 isa => 'ArrayRef',
18 is => 'ro',
19 lazy => 1,
20 handles => {
21 all_authors => 'elements',
22 },
23 1 ▶ default => sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
24 1 my $self = shift;
25 1 ▶ $self->stash->{authors} || [];
Branch: 1 branch
BranchTrueFalseTotal
$self->stash->{"authors"} or [] 0 1 1
26 },
27 3 );
28  
29 2 ▶sub munge($self, $doc) {
Subroutine munge: called CC=3 SCAR=11.6
30  
31 2 ▶ my @authors = $self->all_authors
Branch: 1 branch
BranchTrueFalseTotal
my(@authors) = $self->all_authors or return 1 1 2
32 or return;
33  
34 1 my $title = 'AUTHORS';
35  
36 1 ▶ if ( @authors == 1 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@authors == 1) { } 1 0 1
37 1 chop $title;
38 1 $doc->find_or_create_section(
39 $title,
40 1,
41 $title,
42 para => @authors
43 );
44 }
45 else {
46 $doc->dom->append(
47 $self->xml_write( section => [
48 head1 => $title,
49 'over-text' => [
50 0 map { ('item-text' => $_) } @authors
51 ]
52 ])
53 )
54 }
55 }
56  
57 3 1;
58  
59 __END__
« Knit/Document.pm ↑ Summary Knit/Output/Pod.pm »