Knit/Document/Mojo.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 1 totaltotal 83.3% 40 / 48 CC 5 SCAR 10.0
CC
5
Cov
89%
find_or_create_section
5.4
__ANON__
1.1
_build_dom
1.1
CRAP 2.7
« Knit/PodParser.pm ↑ Summary Knit/Document/WebQuery.pm »
1 package Pod::Knit::Document::Mojo;
2 3 our $AUTHORITY = 'cpan:YANICK';
3 # ABSTRACT: manipulate a Pod::Knit::Document using Mojo::DOM58
4 3 $Pod::Knit::Document::Mojo::VERSION = '0.0.1';
5 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use Mojo::DOM58;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 3 ▶use MooseX::MungeHas { has_ro => [ 'is_ro' ] };
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 3 ▶use experimental qw/ signatures /;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 0 ▶has_ro dom => sub ($self) {
Subroutine __ANON__: not called CC=1 SCAR=1.2
Subroutine _build_dom: called CC=1 SCAR=1.2
17 0 Mojo::DOM58->new( $self->xml_pod )
18 3 };
19  
20 2 ▶sub find_or_create_section( $self, $name, $level = 1, $class = $name, @rest ) {
Subroutine find_or_create_section: called CC=5 SCAR=16.8
Pod undocumented
21  
22 2 ▶ $class //= $name;
Condition33%1/3
$class //= $name
l!l&&r!l&&!r
020
MC/DC0%0/2
$class //= $name
$class $name
Truth table33%1/3
A //= B
A= $classB= $name
ABresult
1X1
011
000
23  
24 2 my $section = $self->dom->find( join '.', 'section', $name );
25  
26 2 ▶ return $section if $section->size;
Branch: 1 branch
BranchTrueFalseTotal
if $section->size 0 2 2
27  
28 2 $self->dom->find('document')->first->append_content(
29 $self->xml_write( section => [
30 ':class' => lc($class),
31 'head' . $level => $name,
32 @rest,
33 ])
34 );
35  
36 2 return $self->dom->find( 'section.'. $name );
37 }
38  
39 3 1;
40  
41 __END__
« Knit/PodParser.pm ↑ Summary Knit/Document/WebQuery.pm »