| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package CPAN::Changes::Entry; |
|
2
|
32
|
|
|
32
|
|
285
|
use strict; |
|
|
32
|
|
|
|
|
72
|
|
|
|
32
|
|
|
|
|
1031
|
|
|
3
|
32
|
|
|
32
|
|
194
|
use warnings; |
|
|
32
|
|
|
|
|
89
|
|
|
|
32
|
|
|
|
|
1816
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.500_001'; |
|
6
|
|
|
|
|
|
|
$VERSION =~ tr/_//d; |
|
7
|
|
|
|
|
|
|
|
|
8
|
32
|
|
|
32
|
|
224
|
use Moo; |
|
|
32
|
|
|
|
|
95
|
|
|
|
32
|
|
|
|
|
242
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'CPAN::Changes::HasEntries'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has text => (is => 'ro'); |
|
13
|
|
|
|
|
|
|
has line => (is => 'ro'); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub serialize { |
|
16
|
|
|
|
|
|
|
my ($self, %args) = @_; |
|
17
|
|
|
|
|
|
|
my $indents = $args{indents} || []; |
|
18
|
|
|
|
|
|
|
my $styles = $args{styles} || []; |
|
19
|
|
|
|
|
|
|
my $width = $args{width} || 75; |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $indent = $indents->[0]; |
|
22
|
|
|
|
|
|
|
my $style = $styles->[0]; |
|
23
|
|
|
|
|
|
|
my $text = $self->text; |
|
24
|
|
|
|
|
|
|
if (length($style) < 2) { |
|
25
|
|
|
|
|
|
|
my $space = ' ' x (2 * length $style); |
|
26
|
|
|
|
|
|
|
$width -= length $space; |
|
27
|
|
|
|
|
|
|
$text =~ s/\G[ \t]*([^\n]{1,$width}|[^ \t\r\n]+)([ \t\r\n]+|$)/$1\n/mg; |
|
28
|
|
|
|
|
|
|
$text =~ s/[ \t]+\n/\n/g; |
|
29
|
|
|
|
|
|
|
$text =~ s/^(.)/$space$1/mg; |
|
30
|
|
|
|
|
|
|
substr $text, 0, length($style), $style; |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
# can't wrap this style |
|
33
|
|
|
|
|
|
|
elsif (length($style) % 2 == 0) { |
|
34
|
|
|
|
|
|
|
my $length = length($style) / 2; |
|
35
|
|
|
|
|
|
|
$text = substr($style, 0, $length) . $text . substr($style, $length) . "\n"; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
else { |
|
38
|
|
|
|
|
|
|
die "invalid changelog entry style '$style'"; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
return $text; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
__END__ |