blib/lib/Pod/Weaver/Section/Author/GETTY/Support.pm

filter: Statementstmt 100% 29 / 29 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 95.2% 40 / 42 CC 6 SCAR 15.6
CC
6
Cov
95%
__ANON__
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« blib/lib/Pod/Elemental/Transformer/Author/GETTY.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/GETTY/Binary.pm »
1 package Pod::Weaver::Section::Author::GETTY::Support;
2 # ABSTRACT: Support section that is left out when it has nothing to say
3 4 our $VERSION = '0.328';
4 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 extends 'Pod::Weaver::Section::GenerateSection';
6  
7 4 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 81 ▶around weave_section => sub {
Subroutine __ANON__: called CC=6 SCAR=17.9
11 81 my ($orig, $self, $document, $input) = @_;
12  
13 # GenerateSection fills its template stash from
14 # $input->{distmeta}{resources}{repository}{web} and the like, which
15 # autovivifies empty resources, repository and bugtracker hashes in the
16 # dist's own distmeta, the one META.json is written from. It gets a copy of
17 # distmeta with a copy of resources, which it may vivify freely.
18 81 ▶ if (ref $input->{distmeta} eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $input->{"distmeta"} eq "HASH") 80 1 81
19 80 my %distmeta = %{ $input->{distmeta} };
20 80 ▶ $distmeta{resources} = { %{ $distmeta{resources} } } if ref $distmeta{resources} eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $distmeta{"resources"} eq "HASH" 78 2 80
21 80 $input = { %$input, distmeta => \%distmeta };
22 }
23  
24 81 my $before = scalar @{ $document->children };
25 81 $self->$orig($document, $input);
26 81 ▶ return if @{ $document->children } == $before;
Branch: 1 branch
BranchTrueFalseTotal
if @{$document->children;} == $before 0 81 81
27  
28 81 my $section = $document->children->[-1];
29 81 ▶ my @text = $section->can('children') ? @{ $section->children } : ($section);
Branch: 1 branch
BranchTrueFalseTotal
$section->can('children') ? : 81 0 81
30 81 ▶ pop @{ $document->children } unless grep { $_->content =~ /\S/ } @text;
Branch: 1 branch
BranchTrueFalseTotal
unless grep {$_->content =~ /\S/;} @text 10 71 81
31 4 };
32  
33 4 __PACKAGE__->meta->make_immutable;
34  
35 4 1;
36  
37 __END__
« blib/lib/Pod/Elemental/Transformer/Author/GETTY.pm ↑ Summary blib/lib/Dist/Zilla/Plugin/Author/GETTY/Binary.pm »