blib/lib/CPAN/Changes/Entry.pm

filter: Statementstmt 96.9% 32 / 33 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 84.3% 43 / 51 CC 6 SCAR 15.0
CC
6
Cov
88%
serialize
6.2
BEGIN
1.0
BEGIN
1.0
CRAP 4.5
« blib/lib/CPAN/Changes/Release.pm ↑ Summary blib/lib/CPAN/Changes/Group.pm »
1 package CPAN::Changes::Entry;
2 32 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 32 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 28 our $VERSION = '0.500002';
6 28 $VERSION =~ tr/_//d;
7  
8 32 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 28 with 'CPAN::Changes::HasEntries';
11  
12 28 has text => (is => 'ro');
13 28 has line => (is => 'ro');
14  
15 sub serialize {
16 62 ▶ my ($self, %args) = @_;
Subroutine serialize: called CC=6 SCAR=18.3
Pod documented
17 62 ▶ my $indents = $args{indents} || [];
Condition50%1/2
$args{'indents'} || []
l!l
620
MC/DC0%0/1
$args{'indents'} || []
$args{'indents'}
Truth table50%1/2
A
A= $args{'indents'}
Aresult
11
00
18 62 ▶ my $styles = $args{styles} || [];
Condition50%1/2
$args{'styles'} || []
l!l
620
MC/DC0%0/1
$args{'styles'} || []
$args{'styles'}
Truth table50%1/2
A
A= $args{'styles'}
Aresult
11
00
19 62 ▶ my $width = $args{width} || 75;
Condition50%1/2
$args{'width'} || 75
l!l
620
MC/DC0%0/1
$args{'width'} || 75
$args{'width'}
Truth table50%1/2
A
A= $args{'width'}
Aresult
11
00
20  
21 62 my $indent = $indents->[0];
22 62 my $style = $styles->[0];
23 62 my $text = $self->text;
24 62 ▶ if (length($style) < 2) {
Branch: 2 branches
BranchTrueFalseTotal
if (length $style < 2) { } 40 22 62
elsif (length($style) % 2 == 0) { } 22 0 22
25 40 my $space = ' ' x (2 * length $style);
26 40 $width -= length $space;
27 40 $text =~ s/\G[ \t]*([^\n]{1,$width}|[^ \t\r\n]+)([ \t\r\n]+|$)/$1\n/mg;
28 40 $text =~ s/[ \t]+\n/\n/g;
29 40 $text =~ s/^(.)/$space$1/mg;
30 40 substr $text, 0, length($style), $style;
31 }
32 # can't wrap this style
33 elsif (length($style) % 2 == 0) {
34 22 my $length = length($style) / 2;
35 22 $text = substr($style, 0, $length) . $text . substr($style, $length) . "\n";
36 }
37 else {
38 0 die "invalid changelog entry style '$style'";
39 }
40 62 return $text;
41 }
42  
43 28 1;
44 __END__
« blib/lib/CPAN/Changes/Release.pm ↑ Summary blib/lib/CPAN/Changes/Group.pm »