blib/lib/Locale/TextDomain/OO/Extract/Xslate.pm

filter: Statementstmt 80.6% 117 / 145 Branchbran 75.0% 36 / 48 Conditioncond 42.5% 46 / 108 MC/DCmcdc 23.6% 13 / 55 Subroutinesub 100% 17 / 17 Podpod 100% 1 / 1 totaltotal 61.5% 230 / 374 CC 69 SCAR 51.3
CC
69
Cov
66%
_walker
280.0
_parseMsg
22.9
extract
7.2
CRAP 169.0
↑ Summary
1 package Locale::TextDomain::OO::Extract::Xslate;
2 3 $Locale::TextDomain::OO::Extract::Xslate::VERSION = '0.04';
3 # vim:syntax=perl:tabstop=4:number:expandtab:
4  
5 # ABSTRACT: Extract messages from Text::Xslate templates for translation with Locale::TextDomain::OO
6  
7 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 3 ▶use Path::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 3 with qw( Locale::TextDomain::OO::Extract::Role::File );
14  
15 3 has 'debug' => (
16 is => 'rw',
17 default => 0,
18 );
19  
20 3 has 'syntax' => (
21 is => 'ro',
22 default => 'Kolon',
23 );
24  
25 3 has 'parser' => (
26 is => 'lazy',
27 init_arg => undef,
28 );
29  
30 has 'l10n_function_re' => (
31 is => 'ro',
32 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
33 7 qr{\A
34 N?
35 (?:loc|_)
36 _
37 (x|n|nx|p|px|np|npx)?
38 \Z
39 }x
40 },
41 3 );
42  
43 3 has 'addl_l10n_function_re' => ( is => 'rw', );
44  
45  
46 7 ▶sub _build_parser {
Subroutine _build_parser: called CC=2 SCAR=6.9
47 7 my $self = shift;
48 7 my $syntax = $self->syntax;
49 7 ▶ eval "use Text::Xslate::Syntax::${syntax};";
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
50 7 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 7 7
51 7 "Text::Xslate::Syntax::${syntax}"->new();
52 }
53  
54  
55 13 ▶sub extract {
Subroutine extract: called CC=7 SCAR=19.8
Pod documented
56 13 my $self = shift;
57 13 my $messages = [];
58 13 my $filename = $self->filename;
59 13 $self->_scan_file( $messages, $filename );
60  
61 13 my ( $cat, $dom ) = ( $self->category, $self->domain );
62 13 foreach my $msg ( @{$messages} ) {
63 $self->add_message(
64 {
65 category => ( $cat // '' ),
66 domain => ( $dom // '' ),
67 msgctxt => ( $msg->{'MSGCTXT'} // '' ),
68 msgid => ( $msg->{'MSGID'} // '' ),
69 msgid_plural => ( $msg->{'MSGID_PLURAL'} // '' ),
70 51 ▶ reference => sprintf( '%s:%s', $msg->{'FILE'}, $msg->{'LINE'} ),
Condition70%7/10
$cat // ""
l!l
510
$dom // ""
l!l
510
$msg->{"MSGCTXT"} // ""
l!l
1041
$msg->{"MSGID"} // ""
l!l
510
$msg->{"MSGID_PLURAL"} // ""
l!l
843
MC/DC0%0/1
$cat // ""
$cat
MC/DC0%0/1
$dom // ""
$dom
MC/DC100%1/1
$msg->{"MSGCTXT"} // ""
$msg->{"MSGCTXT"}
MC/DC0%0/1
$msg->{"MSGID"} // ""
$msg->{"MSGID"}
MC/DC100%1/1
$msg->{"MSGID_PLURAL"} // ""
$msg->{"MSGID_PLURAL"}
Truth table50%1/2
A
A= $cat
Aresult
11
00
Truth table50%1/2
A
A= $dom
Aresult
11
00
Truth table100%2/2
A
A= $msg->{"MSGCTXT"}
Aresult
11
00
Truth table50%1/2
A
A= $msg->{"MSGID"}
Aresult
11
00
Truth table100%2/2
A
A= $msg->{"MSGID_PLURAL"}
Aresult
11
00
71  
72 # automatic => 'my automatic comment',
73 }
74 );
75 }
76 }
77  
78 3 our $RESULT;
79 3 our $FILENAME;
80  
81  
82 13 ▶sub _scan {
Subroutine _scan: called CC=1 SCAR=0.0
83 13 my ( $self, $result, $filename, $data ) = @_;
84 13 my $ast = $self->parser->parse( $data );
85 13 local $FILENAME = $filename;
86 13 local $RESULT = $result;
87 13 $self->_walker( $ast );
88 13 return $result;
89 }
90  
91  
92 13 ▶sub _scan_file {
Subroutine _scan_file: called CC=1 SCAR=0.0
93 13 my ( $self, $result, $filename ) = @_;
94 13 my $data = path( $filename )->slurp_utf8;
95 13 return $self->_scan( $result, $filename, $data );
96 }
97  
98 3 my $sp = '';
99  
100  
101 2593 ▶sub _walker {
Subroutine _walker: called CC=50 SCAR=56.3
102 2593 my ( $self, $ast ) = @_;
103 2593 ▶ $ast = [$ast] if $ast && ref( $ast ) eq 'Text::Xslate::Symbol';
Branch: 1 branch
BranchTrueFalseTotal
if $ast and ref $ast eq "Text::Xslate::Symbol" 133 2460 2593
Condition100%3/3
$ast and ref $ast eq "Text::Xslate::Symbol"
!ll&&!rl&&r
2069391133
MC/DC100%2/2
$ast and ref $ast eq "Text::Xslate::Symbol"
$ast ref $ast eq "Text::Xslate::Symbol"
Truth table100%3/3
A and B
A= $astB= ref $ast eq "Text::Xslate::Symbol"
ABresult
0X0
100
111
104 2593 ▶ return unless $ast && ref( $ast ) eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless $ast and ref $ast eq "ARRAY" 2069 524 2593
Condition66%2/3
$ast and ref $ast eq "ARRAY"
!ll&&!rl&&r
20690524
MC/DC50%1/2
$ast and ref $ast eq "ARRAY"
$ast ref $ast eq "ARRAY"
Truth table66%2/3
A and B
A= $astB= ref $ast eq "ARRAY"
ABresult
0X0
100
111
105  
106 524 my $l10n_fns = $self->l10n_function_re;
107 524 ▶ if ( my $addl_l10n_fns = $self->addl_l10n_function_re ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $addl_l10n_fns = $self->addl_l10n_function_re) 98 426 524
108 98 $l10n_fns = qr{
109 (?: $l10n_fns )
110 |
111 (?: \A N? $addl_l10n_fns \z )
112 }x;
113 }
114  
115 524 for my $sym ( @{$ast} ) {
116  
117 870 ▶ next if ref $sym eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $sym eq "ARRAY" 1 869 870
118  
119 869 ▶ if ( $sym->arity eq 'methodcall' && $sym->value eq '.' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($sym->arity eq 'methodcall' and $sym->value eq '.') { } 23 846 869
elsif ($sym->arity eq 'call' and defined $sym->value and $sym->value eq '(' || $sym->value eq '(call)') { } 46 1600 1646
Condition66%2/3
$sym->arity eq "methodcall" and $sym->value eq "."
!ll&&!rl&&r
846023
MC/DC50%1/2
$sym->arity eq "methodcall" and $sym->value eq "."
$sym->arity eq "methodcall" $sym->value eq "."
Truth table66%2/3
A and B
A= $sym->arity eq "methodcall"B= $sym->value eq "."
ABresult
0X0
100
111
120 23 my $second = $sym->second;
121 23 ▶ if ( $second && ref( $second ) eq 'Text::Xslate::Symbol' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($second and ref $second eq "Text::Xslate::Symbol") 23 0 23
Condition33%1/3
$second and ref $second eq "Text::Xslate::Symbol"
!ll&&!rl&&r
0023
MC/DC0%0/2
$second and ref $second eq "Text::Xslate::Symbol"
$second ref $second eq "Text::Xslate::Symbol"
Truth table33%1/3
A and B
A= $secondB= ref $second eq "Text::Xslate::Symbol"
ABresult
0X0
100
111
122 23 ▶ if ( $second->arity eq 'literal'
Branch: 1 branch
BranchTrueFalseTotal
if ($second->arity eq "literal" and $second->value =~ /$l10n_fns/) 17 6 23
Condition66%2/3
$second->arity eq "literal" and $second->value =~ /$l10n_fns/
!ll&&!rl&&r
0617
MC/DC50%1/2
$second->arity eq "literal" and $second->value =~ /$l10n_fns/
$second->arity eq "literal" $second->value =~ /$l10n_fns/
Truth table66%2/3
A and B
A= $second->arity eq "literal"B= $second->value =~ /$l10n_fns/
ABresult
0X0
100
111
123 && $second->value =~ $l10n_fns )
124 {
125 17 ▶ my $flags = ( $1 || '' );
Condition100%2/2
$1 || ''
l!l
89
MC/DC100%1/1
$1 || ''
$1
Truth table100%2/2
A
A= $1
Aresult
11
00
126 17 my $third = $sym->third;
127 17 ▶ if ( $third
Branch: 2 branches
BranchTrueFalseTotal
if ($third and ref $third eq 'ARRAY' and $third->[0] and ref $third->[0] eq 'Text::Xslate::Symbol' and not $third->[0]->arity =~ /^(?: variable | methodcall | field )$/x) { } 14 3 17
elsif ($third->[0]->arity =~ /^(?: variable | methodcall | field )$/x) { } 3 0 3
Condition41%5/12
$third and ref $third eq "ARRAY" and $third->[0] and ref $third->[0] eq "Text::Xslate::Symbol" and not $third->[0]->arity =~ /^(?: variable | methodcall | field )$/x
!ll&&!rl&&r
0314
$third and ref $third eq "ARRAY" and $third->[0] and ref $third->[0] eq "Text::Xslate::Symbol"
!ll&&!rl&&r
0017
$third and ref $third eq "ARRAY" and $third->[0]
!ll&&!rl&&r
0017
$third and ref $third eq "ARRAY"
!ll&&!rl&&r
0017
MC/DC20%1/5
$third and ref $third eq "ARRAY" and $third->[0] and ref $third->[0] eq "Text::Xslate::Symbol" and not $third->[0]->arity =~ /^(?: variable | methodcall | field )$/x
$third ref $third eq "ARRAY" $third->[0] ref $third->[0] eq "Text::Xslate::Symbol" not $third->[0]->arity =~ /^(?: variable | methodcall | field )$/x
Truth table33%2/6
A and B and C and D and not(E)
A= $thirdB= ref $third eq "ARRAY"C= $third->[0]D= ref $third->[0] eq "Text::Xslate::Symbol"E= not $third->[0]->arity =~ /^(?: variable | methodcall | field )$/x
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
128 && ref( $third ) eq 'ARRAY'
129 && $third->[0]
130 && ref( $third->[0] ) eq 'Text::Xslate::Symbol'
131 && $third->[0]->arity !~ /^(?: variable | methodcall | field )$/x )
132 {
133 14 my %msg = ( FILE => $FILENAME, LINE => $second->line, FLAGS => $flags, );
134 14 ▶ if ( _parseMsg( \%msg, $flags, $third ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_parseMsg(\%msg, $flags, $third)) { } 14 0 14
135 14 push @{$RESULT}, \%msg;
136 }
137 else {
138 0 warn "Invalid parameters for translation command at '$FILENAME', line " . $second->line;
139 }
140 }
141 elsif ( $third->[0]->arity =~ /^(?: variable | methodcall | field )$/x ) {
142 3 next; # skip __($foo), __($foo.bar): nothing to do
143 }
144 else {
145 0 warn "Invalid parameters for translation command at '$FILENAME', line " . $second->line;
146 }
147 }
148 }
149 }
150 ▶ elsif (
Condition66%6/9
$sym->arity eq "call" and defined $sym->value and $sym->value eq "(" || $sym->value eq "(call)"
!ll&&!rl&&r
800046
$sym->arity eq "call" and defined $sym->value
!ll&&!rl&&r
800046
$sym->value eq "(" or $sym->value eq "(call)"
l!l&&r!l&&!r
27190
MC/DC25%1/4
$sym->arity eq "call" and defined $sym->value and $sym->value eq "(" || $sym->value eq "(call)"
$sym->arity eq "call" defined $sym->value $sym->value eq "(" $sym->value eq "(call)"
Truth table60%3/5
A and B and C or D
A= $sym->arity eq "call"B= defined $sym->valueC= $sym->value eq "("D= $sym->value eq "(call)"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
151 $sym->arity eq 'call'
152 && defined $sym->value
153 &&
154  
155 # __x("foo") "foo" | __x
156 ( $sym->value eq '(' or $sym->value eq '(call)' )
157 )
158 {
159 46 my $first = $sym->first;
160 46 ▶ if ( $first && ref( $first ) eq 'Text::Xslate::Symbol' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($first and ref $first eq "Text::Xslate::Symbol") 46 0 46
Condition33%1/3
$first and ref $first eq "Text::Xslate::Symbol"
!ll&&!rl&&r
0046
MC/DC0%0/2
$first and ref $first eq "Text::Xslate::Symbol"
$first ref $first eq "Text::Xslate::Symbol"
Truth table33%1/3
A and B
A= $firstB= ref $first eq "Text::Xslate::Symbol"
ABresult
0X0
100
111
161 46 ▶ if ( $first->arity eq 'name'
Branch: 1 branch
BranchTrueFalseTotal
if ($first->arity eq "name" and $first->value =~ /$l10n_fns/) 43 3 46
Condition66%2/3
$first->arity eq "name" and $first->value =~ /$l10n_fns/
!ll&&!rl&&r
0343
MC/DC50%1/2
$first->arity eq "name" and $first->value =~ /$l10n_fns/
$first->arity eq "name" $first->value =~ /$l10n_fns/
Truth table66%2/3
A and B
A= $first->arity eq "name"B= $first->value =~ /$l10n_fns/
ABresult
0X0
100
111
162 && $first->value =~ $l10n_fns )
163 {
164 43 ▶ my $flags = ( $1 || '' );
Condition100%2/2
$1 || ''
l!l
1231
MC/DC100%1/1
$1 || ''
$1
Truth table100%2/2
A
A= $1
Aresult
11
00
165 43 my $second = $sym->second;
166 43 ▶ if ( $second
Branch: 2 branches
BranchTrueFalseTotal
if ($second and ref $second eq 'ARRAY' and $second->[0] and ref $second->[0] eq 'Text::Xslate::Symbol' and not $second->[0]->arity =~ /^(?: variable | methodcall | field )$/x) { } 37 6 43
elsif ($second->[0]->arity =~ /^(?: variable | methodcall | field )$/x) { } 6 0 6
Condition41%5/12
$second and ref $second eq "ARRAY" and $second->[0] and ref $second->[0] eq "Text::Xslate::Symbol" and not $second->[0]->arity =~ /^(?: variable | methodcall | field )$/x
!ll&&!rl&&r
0637
$second and ref $second eq "ARRAY" and $second->[0] and ref $second->[0] eq "Text::Xslate::Symbol"
!ll&&!rl&&r
0043
$second and ref $second eq "ARRAY" and $second->[0]
!ll&&!rl&&r
0043
$second and ref $second eq "ARRAY"
!ll&&!rl&&r
0043
MC/DC20%1/5
$second and ref $second eq "ARRAY" and $second->[0] and ref $second->[0] eq "Text::Xslate::Symbol" and not $second->[0]->arity =~ /^(?: variable | methodcall | field )$/x
$second ref $second eq "ARRAY" $second->[0] ref $second->[0] eq "Text::Xslate::Symbol" not $second->[0]->arity =~ /^(?: variable | methodcall | field )$/x
Truth table33%2/6
A and B and C and D and not(E)
A= $secondB= ref $second eq "ARRAY"C= $second->[0]D= ref $second->[0] eq "Text::Xslate::Symbol"E= not $second->[0]->arity =~ /^(?: variable | methodcall | field )$/x
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
167 && ref( $second ) eq 'ARRAY'
168 && $second->[0]
169 && ref( $second->[0] ) eq 'Text::Xslate::Symbol'
170 && $second->[0]->arity !~ /^(?: variable | methodcall | field )$/x )
171 {
172 37 my %msg = ( FILE => $FILENAME, LINE => $first->line, FLAGS => $flags, );
173 37 ▶ if ( _parseMsg( \%msg, $flags, $second ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (_parseMsg(\%msg, $flags, $second)) { } 37 0 37
174 37 push @{$RESULT}, \%msg;
175 }
176 else {
177 0 warn "Invalid parameters for translation command at '$FILENAME', line " . $first->line;
178 }
179 }
180 elsif ( $second->[0]->arity =~ /^(?: variable | methodcall | field )$/x ) {
181 6 next; # skip __($foo), __($foo.bar): nothing to do
182 }
183 else {
184 0 warn "Invalid parameters for translation command at '$FILENAME', line " . $first->line;
185 }
186 }
187 }
188 }
189  
190 860 ▶ unless ( $self->debug ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->debug) { } 0 860 860
191 860 $self->_walker( $sym->first );
192 860 $self->_walker( $sym->second );
193 860 $self->_walker( $sym->third );
194 }
195 else {
196 0 ▶ warn $sp . "id: " . ( $sym->id // "undef()" ) . "\n";
Condition0%0/2
$sym->id // "undef()"
l!l
00
MC/DC0%0/1
$sym->id // "undef()"
$sym->id
Truth table0%0/2
A
A= $sym->id
Aresult
11
00
197 0 ▶ warn $sp . "line: " . ( $sym->line // "undef()" ) . "\n";
Condition0%0/2
$sym->line // "undef()"
l!l
00
MC/DC0%0/1
$sym->line // "undef()"
$sym->line
Truth table0%0/2
A
A= $sym->line
Aresult
11
00
198 0 ▶ warn $sp . "ldp: " . ( $sym->lbp // "undef()" ) . "\n";
Condition0%0/2
$sym->lbp // "undef()"
l!l
00
MC/DC0%0/1
$sym->lbp // "undef()"
$sym->lbp
Truth table0%0/2
A
A= $sym->lbp
Aresult
11
00
199 0 ▶ warn $sp . "udp: " . ( $sym->ubp // "undef()" ) . "\n";
Condition0%0/2
$sym->ubp // "undef()"
l!l
00
MC/DC0%0/1
$sym->ubp // "undef()"
$sym->ubp
Truth table0%0/2
A
A= $sym->ubp
Aresult
11
00
200 0 ▶ warn $sp . "type: " . ( $sym->type // "undef()" ) . "\n";
Condition0%0/2
$sym->type // "undef()"
l!l
00
MC/DC0%0/1
$sym->type // "undef()"
$sym->type
Truth table0%0/2
A
A= $sym->type
Aresult
11
00
201 0 ▶ warn $sp . "arity: " . ( $sym->arity // "undef()" ) . "\n";
Condition0%0/2
$sym->arity // "undef()"
l!l
00
MC/DC0%0/1
$sym->arity // "undef()"
$sym->arity
Truth table0%0/2
A
A= $sym->arity
Aresult
11
00
202 0 ▶ warn $sp . "assignment: " . ( $sym->assignment // "undef()" ) . "\n";
Condition0%0/2
$sym->assignment // "undef()"
l!l
00
MC/DC0%0/1
$sym->assignment // "undef()"
$sym->assignment
Truth table0%0/2
A
A= $sym->assignment
Aresult
11
00
203 0 ▶ warn $sp . "value: " . ( $sym->value // "undef()" ) . "\n";
Condition0%0/2
$sym->value // "undef()"
l!l
00
MC/DC0%0/1
$sym->value // "undef()"
$sym->value
Truth table0%0/2
A
A= $sym->value
Aresult
11
00
204  
205 0 ▶ warn $sp . "= first: " . ( $sym->first // "undef()" ) . "\n";
Condition0%0/2
$sym->first // "undef()"
l!l
00
MC/DC0%0/1
$sym->first // "undef()"
$sym->first
Truth table0%0/2
A
A= $sym->first
Aresult
11
00
206 0 $sp .= ' ';
207 0 $self->_walker( $sym->first );
208 0 $sp =~ s/^..//;
209  
210 0 ▶ warn $sp . "= second: " . ( $sym->second // "undef()" ) . "\n";
Condition0%0/2
$sym->second // "undef()"
l!l
00
MC/DC0%0/1
$sym->second // "undef()"
$sym->second
Truth table0%0/2
A
A= $sym->second
Aresult
11
00
211 0 $sp .= ' ';
212 0 $self->_walker( $sym->second );
213 0 $sp =~ s/^..//;
214  
215 0 ▶ warn $sp . "= third: " . ( $sym->third // "undef()" ) . "\n";
Condition0%0/2
$sym->third // "undef()"
l!l
00
MC/DC0%0/1
$sym->third // "undef()"
$sym->third
Truth table0%0/2
A
A= $sym->third
Aresult
11
00
216 0 $sp .= ' ';
217 0 $self->_walker( $sym->third );
218 0 $sp =~ s/^..//;
219  
220 0 warn $sp . "----------\n";
221 }
222 } ## end for my $sym ( @{$ast} )
223 } ## end sub _walker
224  
225  
226 51 ▶sub _parseMsg {
Subroutine _parseMsg: called CC=13 SCAR=31.3
227 51 my ( $msg_r, $flags, $params ) = @_;
228  
229 51 my @p = @{$params};
230 51 eval {
231 51 ▶ if ( index( $flags, 'p' ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($flags, "p") != -1) 10 41 51
232 10 ▶ if ( defined $p[0] and $p[0]->arity eq 'literal' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p[0] and $p[0]->arity eq 'literal') { } 10 0 10
Condition33%1/3
defined $p[0] and $p[0]->arity eq "literal"
!ll&&!rl&&r
0010
MC/DC0%0/2
defined $p[0] and $p[0]->arity eq "literal"
defined $p[0] $p[0]->arity eq "literal"
Truth table33%1/3
A and B
A= defined $p[0]B= $p[0]->arity eq "literal"
ABresult
0X0
100
111
233 10 $msg_r->{'MSGCTXT'} = $p[0]->value;
234 10 shift @p;
235 }
236 else {
237 0 die;
238 }
239 }
240  
241 51 ▶ if ( index( $flags, 'n' ) >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (index($flags, 'n') != -1) { } 8 43 51
242 8 ▶ if ( defined $p[0]
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p[0] and $p[0]->arity eq 'literal' and defined $p[1] and $p[1]->arity eq 'literal' and defined $p[2]) { } 8 0 8
Condition33%4/12
defined $p[0] and $p[0]->arity eq "literal" and defined $p[1] and $p[1]->arity eq "literal" and defined $p[2]
!ll&&!rl&&r
008
defined $p[0] and $p[0]->arity eq "literal" and defined $p[1] and $p[1]->arity eq "literal"
!ll&&!rl&&r
008
defined $p[0] and $p[0]->arity eq "literal" and defined $p[1]
!ll&&!rl&&r
008
defined $p[0] and $p[0]->arity eq "literal"
!ll&&!rl&&r
008
MC/DC0%0/5
defined $p[0] and $p[0]->arity eq "literal" and defined $p[1] and $p[1]->arity eq "literal" and defined $p[2]
defined $p[0] $p[0]->arity eq "literal" defined $p[1] $p[1]->arity eq "literal" defined $p[2]
Truth table16%1/6
A and B and C and D and E
A= defined $p[0]B= $p[0]->arity eq "literal"C= defined $p[1]D= $p[1]->arity eq "literal"E= defined $p[2]
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
243 and $p[0]->arity eq 'literal'
244 and defined $p[1]
245 and $p[1]->arity eq 'literal'
246 and defined $p[2] )
247 {
248 8 $msg_r->{'MSGID'} = $p[0]->value;
249 8 $msg_r->{'MSGID_PLURAL'} = $p[1]->value;
250 }
251 else {
252 0 die;
253 }
254 }
255 else {
256 43 ▶ if ( defined $p[0] and $p[0]->arity eq 'literal' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $p[0] and $p[0]->arity eq 'literal') { } 43 0 43
Condition33%1/3
defined $p[0] and $p[0]->arity eq "literal"
!ll&&!rl&&r
0043
MC/DC0%0/2
defined $p[0] and $p[0]->arity eq "literal"
defined $p[0] $p[0]->arity eq "literal"
Truth table33%1/3
A and B
A= defined $p[0]B= $p[0]->arity eq "literal"
ABresult
0X0
100
111
257 43 $msg_r->{'MSGID'} = $p[0]->value;
258 }
259 else {
260 0 die;
261 }
262 }
263 };
264  
265 51 ▶ return 0 if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 51 51
266 51 return 1;
267 } ## end sub _parseMsg
268  
269 3 __PACKAGE__->meta->make_immutable;
270  
271 3 1;
272  
273 __END__
↑ Summary