| 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 ||= ""
MC/DC0%0/1
$filename ||= ""
$filename
Truth table50%1/2
A
A= $filename
| |||||||||||||
| 21 | 2 | ▶ | my $content_ref = Locale::PO->load_file_asarray($filename) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 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
| |||||||||||||
| 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
| |||||||||||||
| 44 | ] | ||||||||||||
| 45 | ) | ||||||||||||
| 46 | : (); | ||||||||||||
| 47 | }, | ||||||||||||
| 48 | }; | ||||||||||||
| 49 | 2 | } @{$content_ref} | |||||||||||
| 50 | ]; | ||||||||||||
| 51 | } | ||||||||||||
| 52 | |||||||||||||
| 53 | 2 | 1; | |||||||||||
| 54 | |||||||||||||
| 55 | __END__ | ||||||||||||