line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::File::PO::Header::Item; ## no critic (TidyCode) |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
34
|
use Moose; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
32
|
|
4
|
5
|
|
|
5
|
|
33079
|
use MooseX::StrictConstructor; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
30
|
|
5
|
5
|
|
|
5
|
|
14593
|
use namespace::autoclean; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
41
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.004'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
extends qw(Locale::File::PO::Header::Base); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has name => ( |
12
|
|
|
|
|
|
|
is => 'rw', |
13
|
|
|
|
|
|
|
isa => 'Str', |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has default => ( |
17
|
|
|
|
|
|
|
is => 'rw', |
18
|
|
|
|
|
|
|
isa => 'Str', |
19
|
|
|
|
|
|
|
default => q{}, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has item => ( |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
isa => 'Str|Undef', |
25
|
|
|
|
|
|
|
lazy => 1, |
26
|
|
|
|
|
|
|
default => sub { |
27
|
|
|
|
|
|
|
my $self = shift; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
return $self->default; |
30
|
|
|
|
|
|
|
}, |
31
|
|
|
|
|
|
|
trigger => sub { |
32
|
|
|
|
|
|
|
my ($self, $item, $current_item) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return $self->trigger_helper({ |
35
|
|
|
|
|
|
|
new => $item, |
36
|
|
|
|
|
|
|
current => $current_item, |
37
|
|
|
|
|
|
|
default => scalar $self->default, |
38
|
|
|
|
|
|
|
writer => 'item', |
39
|
|
|
|
|
|
|
}); |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub data { |
44
|
8
|
|
|
8
|
0
|
17
|
my ($self, $key, @args) = @_; |
45
|
|
|
|
|
|
|
|
46
|
8
|
100
|
|
|
|
195
|
return $self->item( @args ? $args[0] : () ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub extract_msgstr { |
50
|
12
|
|
|
12
|
0
|
25
|
my ($self, $msgstr_ref) = @_; |
51
|
|
|
|
|
|
|
|
52
|
12
|
|
|
|
|
306
|
my $name = $self->name; |
53
|
12
|
|
|
|
|
20
|
${$msgstr_ref} =~ s{ |
|
12
|
|
|
|
|
257
|
|
54
|
|
|
|
|
|
|
^ |
55
|
|
|
|
|
|
|
\Q$name\E : |
56
|
|
|
|
|
|
|
\s* |
57
|
|
|
|
|
|
|
( [^\n]*? ) |
58
|
|
|
|
|
|
|
\s* |
59
|
|
|
|
|
|
|
$ |
60
|
|
|
|
|
|
|
}{}xmsi; |
61
|
12
|
|
|
|
|
386
|
$self->item($1); ## no critic (CaptureWithoutTest) |
62
|
|
|
|
|
|
|
|
63
|
12
|
|
|
|
|
29
|
return; |
64
|
|
|
|
|
|
|
}; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub lines { |
67
|
18
|
|
|
18
|
0
|
26
|
my $self = shift; |
68
|
|
|
|
|
|
|
|
69
|
18
|
100
|
|
|
|
447
|
length $self->item |
70
|
|
|
|
|
|
|
or return; |
71
|
|
|
|
|
|
|
|
72
|
11
|
|
|
|
|
260
|
return $self->format_line( |
73
|
|
|
|
|
|
|
'{name}: {item}', |
74
|
|
|
|
|
|
|
name => $self->name, |
75
|
|
|
|
|
|
|
item => $self->item, |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# $Id: Utils.pm 602 2011-11-13 13:49:23Z steffenw $ |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |