Header/Item.pm

filter: Statementstmt 100% 31 / 31 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 3 totaltotal 93.4% 43 / 46 CC 3 SCAR 3.4
CC
3
Cov
100%
data
2.0
lines
2.0
BEGIN
1.0
CRAP 1.4
« Header/ExtendedItem.pm ↑ Summary
1 package Locale::File::PO::Header::Item; ## no critic (TidyCode)
2
3 5 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 5 our $VERSION = '0.004';
8
9 5 extends qw(Locale::File::PO::Header::Base);
10
11 5 has name => (
12 is => 'rw',
13 isa => 'Str',
14 );
15
16 5 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 6 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
27 6 my $self = shift;
28
29 6 return $self->default;
30 },
31 35 ▶ trigger => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
32 35 my ($self, $item, $current_item) = @_;
33
34 35 return $self->trigger_helper({
35 new => $item,
36 current => $current_item,
37 default => scalar $self->default,
38 writer => 'item',
39 });
40 },
41 5 );
42
43 8 ▶sub data {
Subroutine data: called CC=2 SCAR=6.9
Pod undocumented
44 8 my ($self, $key, @args) = @_;
45
46 8 ▶ return $self->item( @args ? $args[0] : () );
Branch: 1 branch
BranchTrueFalseTotal
@args ? : 6 2 8
47 }
48
49 12 ▶sub extract_msgstr {
Subroutine extract_msgstr: called CC=1 SCAR=0.0
Pod undocumented
50 12 my ($self, $msgstr_ref) = @_;
51
52 12 my $name = $self->name;
53 12 ${$msgstr_ref} =~ s{
54 ^
55 \Q$name\E :
56 \s*
57 ( [^\n]*? )
58 \s*
59 $
60 }{}xmsi;
61 12 $self->item($1); ## no critic (CaptureWithoutTest)
62
63 12 return;
64 };
65
66 18 ▶sub lines {
Subroutine lines: called CC=2 SCAR=6.9
Pod undocumented
67 18 my $self = shift;
68
69 18 ▶ length $self->item
Branch: 1 branch
BranchTrueFalseTotal
length $self->item or return 11 7 18
70 or return;
71
72 11 return $self->format_line(
73 '{name}: {item}',
74 name => $self->name,
75 item => $self->item,
76 );
77 }
78
79 5 __PACKAGE__->meta->make_immutable;
80
81 # $Id: Utils.pm 602 2011-11-13 13:49:23Z steffenw $
82
83 5 1;
« Header/ExtendedItem.pm ↑ Summary