OO/Lexicon/File/PO.pm

filter: Statementstmt 100% 36 / 36 Branchbran 83.3% 5 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 94.3% 50 / 53 CC 5 SCAR 10.4
CC
5
Cov
95%
read_messages
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« OO/Plugin/Language/LanguageOfLanguages.pm ↑ Summary OO/Lexicon/Role/GettextToMaketext.pm »
1 package Locale::TextDomain::OO::Lexicon::File::PO; ## no critic (TidyCode)
2
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Carp qw(confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 require Locale::PO;
7 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use MooX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10
11 2 our $VERSION = '1.031';
12
13 2 with qw(
14 Locale::TextDomain::OO::Lexicon::Role::File
15 );
16
17 2 ▶sub read_messages {
Subroutine read_messages: called CC=5 SCAR=16.1
Pod documented
18 2 my ($self, $filename) = @_;
19
20 2 ▶ $filename ||= q{};
Condition50%1/2
$filename ||= ""
l!l
20
MC/DC0%0/1
$filename ||= ""
$filename
Truth table50%1/2
A
A= $filename
Aresult
11
00
21 2 ▶ my $content_ref = Locale::PO->load_file_asarray($filename)
Branch: 1 branch
BranchTrueFalseTotal
my $content_ref = "Locale::PO"->load_file_asarray($filename) or confess("File not found $filename") 2 0 2
22 or confess "File not found $filename";
23
24 return [
25 map { ## no critic (ComplexMappings)
26 17 my $po = $_;
27 +{
28 do {
29 map { ## no critic (ComplexMappings)
30 17 my $value = $po->$_;
31 68 ▶ defined $value
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 40 28 68
32 ? ( $_ => $po->dequote($value) )
33 : ();
34 } qw( msgctxt msgid msgid_plural msgstr )
35 },
36 17 do {
37 17 my $msgstr_n = $po->msgstr_n;
38 defined $msgstr_n
39 ? (
40 msgstr_plural => [
41 map {
42 14 $po->dequote( $msgstr_n->{$_} );
43 17 ▶ } sort keys %{$msgstr_n}
Branch: 1 branch
BranchTrueFalseTotal
defined $msgstr_n ? : 6 11 17
44 ]
45 )
46 : ();
47 },
48 };
49 2 } @{$content_ref}
50 ];
51 }
52
53 2 1;
54
55 __END__
« OO/Plugin/Language/LanguageOfLanguages.pm ↑ Summary OO/Lexicon/Role/GettextToMaketext.pm »