line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::File::PO::Header::ExtendedItem; ## no critic (TidyCode) |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
32
|
use Moose; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
35
|
|
4
|
5
|
|
|
5
|
|
30507
|
use MooseX::StrictConstructor; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
42
|
|
5
|
5
|
|
|
5
|
|
15565
|
use Moose::Util::TypeConstraints; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
47
|
|
6
|
5
|
|
|
5
|
|
10012
|
use namespace::autoclean; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
50
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
2024
|
use Clone qw(clone); |
|
5
|
|
|
|
|
9335
|
|
|
5
|
|
|
|
|
1815
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
extends qw(Locale::File::PO::Header::Base); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has name => ( |
15
|
|
|
|
|
|
|
is => 'rw', |
16
|
|
|
|
|
|
|
isa => 'Str', |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
subtype ExtendedArray => as 'ArrayRef[Str]' => where { |
20
|
|
|
|
|
|
|
@{$_} % 2 == 0; |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has extended => ( |
24
|
|
|
|
|
|
|
is => 'rw', |
25
|
|
|
|
|
|
|
isa => 'ExtendedArray|Undef', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub data { |
29
|
2
|
|
|
2
|
0
|
7
|
my ($self, $key, @args) = @_; |
30
|
|
|
|
|
|
|
|
31
|
2
|
100
|
|
|
|
62
|
return $self->extended( @args ? $args[0] : () ); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub extract_msgstr { |
35
|
2
|
|
|
2
|
0
|
7
|
my ($self, $msgstr_ref) = @_; |
36
|
|
|
|
|
|
|
|
37
|
2
|
|
|
|
|
35
|
my @extended; |
38
|
2
|
|
|
|
|
5
|
while ( |
39
|
7
|
|
|
|
|
53
|
${$msgstr_ref} =~ s{ |
40
|
|
|
|
|
|
|
^ |
41
|
|
|
|
|
|
|
( [^:\n]*? ) : |
42
|
|
|
|
|
|
|
\s* |
43
|
|
|
|
|
|
|
( [^\n]*? ) |
44
|
|
|
|
|
|
|
\s* |
45
|
|
|
|
|
|
|
$ |
46
|
|
|
|
|
|
|
}{}xms |
47
|
|
|
|
|
|
|
) { |
48
|
5
|
|
|
|
|
22
|
push @extended, $1, $2; |
49
|
|
|
|
|
|
|
} |
50
|
2
|
50
|
|
|
|
82
|
$self->extended( @extended ? \@extended : undef ); |
51
|
|
|
|
|
|
|
|
52
|
2
|
|
|
|
|
7
|
return; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub lines { |
56
|
3
|
|
|
3
|
0
|
8
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
3
|
|
|
|
|
83
|
my $extended = $self->extended; |
59
|
3
|
100
|
|
|
|
14
|
defined $extended |
60
|
|
|
|
|
|
|
or return; |
61
|
|
|
|
|
|
|
|
62
|
2
|
|
|
|
|
25
|
$extended = clone($extended); |
63
|
2
|
|
|
|
|
4
|
my @lines; |
64
|
2
|
|
|
|
|
4
|
while ( my ($name, $value) = splice @{$extended}, 0, 2 ) { |
|
7
|
|
|
|
|
30
|
|
65
|
5
|
|
|
|
|
16
|
push @lines, $self->format_line( |
66
|
|
|
|
|
|
|
'{name}: {value}', |
67
|
|
|
|
|
|
|
name => $name, |
68
|
|
|
|
|
|
|
value => $value, |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
|
|
23
|
return @lines; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# $Id:$ |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |