Structured/LI.pm

filter: Statementstmt 100% 35 / 35 Branchbran 90.0% 9 / 10 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 92.9% 53 / 57 CC 8 SCAR 12.9
CC
8
Cov
98%
is_ok
6.0
new
2.0
process
2.0
CRAP 3.6
« Structured/Block.pm ↑ Summary Structured/Factory.pm »
1 package MKDoc::Text::Structured::LI;
2 20 ▶use base qw /MKDoc::Text::Structured::Base/;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6  
7 sub new
8 29 ▶{
Subroutine new: called CC=2 SCAR=7.0
Pod undocumented
9 29 my $class = shift;
10 29 my $line = shift;
11  
12 29 my ($marker) = $line =~ /^((?:\*|\-|\d+\.)\s+)/;
13 29 ▶ return unless ($marker);
Branch: 1 branch
BranchTrueFalseTotal
unless $marker 0 29 29
14  
15 29 my $self = $class->SUPER::new();
16 29 $self->{indent_re} = " " x length ($marker);
17 29 return $self;
18 }
19  
20  
21 sub is_ok
22 90 ▶{
Subroutine is_ok: called CC=6 SCAR=17.9
Pod undocumented
23 90 my $self = shift;
24 90 ▶ $self->{lines} || return 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"lines"} or return 1 61 29 90
25  
26 61 ▶ my $line = shift || '';
Condition100%2/2
shift() || ''
l!l
4516
MC/DC100%1/1
shift() || ''
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
27 61 my $re = $self->{indent_re};
28 61 ▶ $line eq '' and return 1;
Branch: 1 branch
BranchTrueFalseTotal
$line eq "" and return 1 16 45 61
29 45 ▶ $line =~ /^\s+$/ and return 1;
Branch: 1 branch
BranchTrueFalseTotal
$line =~ /^\s+$/ and return 1 1 44 45
30 44 ▶ $line =~ /^$re/ and return 1;
Branch: 1 branch
BranchTrueFalseTotal
$line =~ /^$re/ and return 1 28 16 44
31 16 return;
32 }
33  
34  
35 sub process
36 29 ▶{
Subroutine process: called CC=2 SCAR=6.9
Pod undocumented
37 29 my $self = shift;
38 29 my @lines = @{$self->{lines}};
39  
40 29 my $re = $self->{indent_re};
41 29 for (@lines) { s/^$re// }
42  
43 29 my $text = join "\n", @lines;
44 29 $text =~ s/^(?:\*|\-|\d+\.)(\s+)//;
45 29 $text = MKDoc::Text::Structured::process ($text);
46 29 return "<li>$text</li>";
47 }
48  
49  
50 20 1;
51  
52  
53 __END__
« Structured/Block.pm ↑ Summary Structured/Factory.pm »