Header/Base.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 87.5% 7 / 8 Conditioncond 100% 7 / 7 MC/DCmcdc 100% 3 / 3 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 4 totaltotal 87.2% 48 / 55 CC 8 SCAR 13.5
CC
8
Cov
95%
trigger_helper
6.0
format_line
3.0
default
2.0
CRAP 3.9
« Header.pm ↑ Summary Header/ExtendedItem.pm »
1 package Locale::File::PO::Header::Base; ## no critic (TidyCode)
2
3 5 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 5 our $VERSION = '0.004';
7
8 0 ▶sub default { ## no critic (BuiltinHomonyms)
Subroutine default: not called CC=1 SCAR=6.9
Pod undocumented
9 0 return;
10 }
11
12 86 ▶sub trigger_helper {
Subroutine trigger_helper: called CC=6 SCAR=17.9
Pod undocumented
13 86 my ($self, $arg_ref) = @_;
14
15 my ($new, $current, $default) = map {
16 258 ▶ defined $_ ? $_ : q{};
Branch: 1 branch
BranchTrueFalseTotal
defined $_ ? : 221 37 258
17 86 } @{$arg_ref}{ qw(new current default) };
18 86 ▶ if ( ! length $new ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (length $new) 35 51 86
19 35 $new = $default;
20 }
21 86 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (defined $arg_ref->{"new"} xor defined $arg_ref->{"current"} or $new ne $current) 44 42 86
Condition100%7/7
defined $arg_ref->{"new"} xor defined $arg_ref->{"current"} or $new ne $current
l!l&&r!l&&!r
311342
defined $arg_ref->{"new"} xor defined $arg_ref->{"current"}
l&&rl&&!r!l&&r!l&&!r
522293
MC/DC100%3/3
defined $arg_ref->{"new"} xor defined $arg_ref->{"current"} or $new ne $current
defined $arg_ref->{"new"} defined $arg_ref->{"current"} $new ne $current
Truth table83%5/6
A xor B or C
A= defined $arg_ref->{"new"}B= defined $arg_ref->{"current"}C= $new ne $current
ABCresult
10X1
01X1
1111
0011
1100
0000
22 ( defined $arg_ref->{new} xor defined $arg_ref->{current} )
23 || $new ne $current
24 ) {
25 44 my $writer = $arg_ref->{writer};
26 44 $self->$writer($new);
27 }
28
29 86 return;
30 }
31
32 21 ▶sub header_keys {
Subroutine header_keys: called CC=1 SCAR=0.0
Pod undocumented
33 21 my $self = shift;
34
35 21 return $self->name;
36 }
37
38 24 ▶sub format_line {
Subroutine format_line: called CC=3 SCAR=11.1
Pod undocumented
39 24 my ($self, $line, %args) = @_;
40
41 24 for my $key ( keys %args ) {
42 56 $line =~ s{
43 [{]
44 \Q$key\E
45 [}]
46 } {
47 defined $args{$key}
48 56 ▶ ? $args{$key}
Branch: 1 branch
BranchTrueFalseTotal
defined $args{$key} ? : 56 0 56
49 : q{}
50 }xmsge;
51 }
52
53 24 return $line;
54 }
55
56 5 __PACKAGE__->meta->make_immutable;
57
58 # $Id: Utils.pm 602 2011-11-13 13:49:23Z steffenw $
59
60 5 1;
« Header.pm ↑ Summary Header/ExtendedItem.pm »