| 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'} || []
MC/DC0%0/1
$args{'indents'} || []
$args{'indents'}
Truth table50%1/2
A
A= $args{'indents'}
| |||||||||||||||
| 18 | 62 | ▶ | my $styles = $args{styles} || []; | ||||||||||||
|
Condition50%1/2
$args{'styles'} || []
MC/DC0%0/1
$args{'styles'} || []
$args{'styles'}
Truth table50%1/2
A
A= $args{'styles'}
| |||||||||||||||
| 19 | 62 | ▶ | my $width = $args{width} || 75; | ||||||||||||
|
Condition50%1/2
$args{'width'} || 75
MC/DC0%0/1
$args{'width'} || 75
$args{'width'}
Truth table50%1/2
A
A= $args{'width'}
| |||||||||||||||
| 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
| |||||||||||||||
| 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__ | ||||||||||||||