Knit/Plugin/HeadsToSections.pm

filter: Statementstmt 50.0% 20 / 40 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 1 totaltotal 40.9% 25 / 61 CC 8 SCAR 28.2
CC
8
Cov
39%
__ANON__
30.0
preprocess
20.0
BEGIN
1.0
CRAP 16.8
« eventual.pl ↑ Summary Knit/PodParser.pm »
1 package Pod::Knit::Plugin::HeadsToSections;
2 1 our $AUTHORITY = 'cpan:YANICK';
3 1 $Pod::Knit::Plugin::HeadsToSections::VERSION = '0.0.1';
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Web::Query;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use List::AllUtils qw/ part /;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 extends 'Pod::Knit::Plugin';
13 1 with 'Pod::Knit::DOM::WebQuery';
14  
15 0 ▶sub preprocess {
Subroutine preprocess: not called CC=4 SCAR=30.0
Pod undocumented
16 0 my( $self, $doc ) = @_;
17  
18 0 for my $level ( reverse 1..4 ) {
19 0 my( $in_section, $index ) = (0,0);
20 0 my @sections;
21  
22 0 ▶ $doc->find( \'./*' )->each(sub{
Subroutine __ANON__: not called CC=5 SCAR=34.0
23 0 ▶ if( $_->tagname =~ /^head(\d+)/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_->tagname =~ /^head(\d+)/) 0 0 0
24 0 ▶ if( $1 == $level ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($1 == $level) { } 0 0 0
elsif ($1 < $level) { } 0 0 0
25 0 $index++;
26 0 $in_section = 1;
27 }
28 elsif( $1 < $level ) {
29 0 $in_section = 0;
30 }
31 }
32 0 ▶ push @{$sections[ $in_section && $index]}, $_;
Condition0%0/3
$in_section && $index
!ll&&!rl&&r
000
MC/DC0%0/2
$in_section && $index
$in_section $index
Truth table0%0/3
A && B
A= $in_sectionB= $index
ABresult
0X0
100
111
33 0 });
34  
35 0 for my $i ( 1..$#sections ) {
36 0 my $s = shift @{ $sections[$i] };
37 0 $s->html(
38 '<title>'. $s->html . '</title>'
39 );
40 0 ▶ while( my $e = shift @{ $sections[$i] } ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $e = shift @{$sections[$i];}) 0 0 0
41 0 $e->detach;
42 0 $s->append($e);
43 }
44 }
45 }
46  
47 }
48  
49 1 1;
50  
51 __END__
« eventual.pl ↑ Summary Knit/PodParser.pm »