| 1 | package Locale::PO; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 9 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 9 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 9 | our $VERSION = '0.27'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 9 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 1970 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=19 SCAR=30.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 1970 | my $this = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 1970 | my %options = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 1970 | ▶ | my $class = ref($this) || $this; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $this || $this
MC/DC0%0/2
ref $this || $this
ref $this
$this
Truth table33%1/3
A || B
A= ref $thisB= $this
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 1970 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 1970 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 1970 | $self->_flags([]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 1970 | ▶ | $self->fuzzy_msgid($options{'-fuzzy_msgid'}) if defined($options{'-fuzzy_msgid'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | $self->fuzzy_msgid_plural($options{'-fuzzy_msgid_plural'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1970 | ▶ | if defined($options{'-fuzzy_msgid_plural'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 1970 | ▶ | $self->msgid($options{'-msgid'}) if defined($options{'-msgid'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | $self->msgid_plural($options{'-msgid_plural'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1970 | ▶ | if defined($options{'-msgid_plural'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1970 | ▶ | $self->msgstr($options{'-msgstr'}) if defined($options{'-msgstr'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | $self->msgstr_n($options{'-msgstr_n'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 1970 | ▶ | if defined($options{'-msgstr_n'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1970 | ▶ | $self->msgctxt($options{'-msgctxt'}) if defined($options{'-msgctxt'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | $self->fuzzy_msgctxt($options{'-fuzzy_msgctxt'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 1970 | ▶ | if defined($options{'-fuzzy_msgctxt'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1970 | ▶ | $self->comment($options{'-comment'}) if defined($options{'-comment'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 1970 | ▶ | $self->fuzzy($options{'-fuzzy'}) if defined($options{'-fuzzy'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | $self->automatic($options{'-automatic'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 1970 | ▶ | if defined($options{'-automatic'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | $self->reference($options{'-reference'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 1970 | ▶ | if defined($options{'-reference'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 1970 | ▶ | $self->c_format(1) if defined($options{'-c-format'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1970 | ▶ | $self->c_format(1) if defined($options{'-c_format'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1970 | ▶ | $self->c_format(0) if defined($options{'-no-c-format'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 1970 | ▶ | $self->c_format(0) if defined($options{'-no_c_format'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | $self->loaded_line_number($options{'-loaded_line_number'}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1970 | ▶ | if defined($options{'-loaded_line_number'}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1970 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1515 | ▶ | sub fuzzy_msgctxt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fuzzy_msgctxt: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 1515 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 1515 | ▶ | @_ ? $self->{'fuzzy_msgctxt'} = $self->quote(shift) : $self->{'fuzzy_msgctxt'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 1834 | ▶ | sub fuzzy_msgid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fuzzy_msgid: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 1834 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 1834 | ▶ | @_ ? $self->{'fuzzy_msgid'} = $self->quote(shift) : $self->{'fuzzy_msgid'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 1518 | ▶ | sub fuzzy_msgid_plural { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fuzzy_msgid_plural: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 1518 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | ? $self->{'fuzzy_msgid_plural'} = $self->quote(shift) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 1518 | ▶ | : $self->{'fuzzy_msgid_plural'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 1521 | ▶ | sub msgctxt { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgctxt: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 1521 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1521 | ▶ | @_ ? $self->{'msgctxt'} = $self->quote(shift) : $self->{'msgctxt'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3486 | ▶ | sub msgid { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 3486 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 3486 | ▶ | @_ ? $self->{'msgid'} = $self->quote(shift) : $self->{'msgid'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 1529 | ▶ | sub msgid_plural { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid_plural: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1529 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | @_ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | ? $self->{'msgid_plural'} = $self->quote(shift) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 1529 | ▶ | : $self->{'msgid_plural'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 4981 | ▶ | sub msgstr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgstr: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 4981 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 4981 | ▶ | @_ ? $self->{'msgstr'} = $self->quote(shift) : $self->{'msgstr'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 1521 | ▶ | sub msgstr_n { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgstr_n: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 1521 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 1521 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 8 | my $hashref = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | # check that we have a hashref. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 8 | ▶ | croak 'Argument to msgstr_n must be a hashref: { n => "string n", ... }.' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | unless ref($hashref) eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | # Check that the keys are all numbers. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | croak 'Keys to msgstr_n hashref must be numbers' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 8 | ▶ | if grep {m/\D/} keys %$hashref; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # Quote all the values in the hashref. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 8 | $self->{'msgstr_n'}{$_} = $self->quote($$hashref{$_}) for keys %$hashref; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 1521 | return $self->{'msgstr_n'}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 1619 | ▶ | sub comment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
comment: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 1619 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 1619 | ▶ | @_ ? $self->{'comment'} = shift : $self->{'comment'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 3798 | ▶ | sub automatic { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
automatic: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 3798 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 3798 | ▶ | @_ ? $self->{'automatic'} = shift : $self->{'automatic'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 4598 | ▶ | sub reference { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reference: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 4598 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 4598 | ▶ | @_ ? $self->{'reference'} = shift : $self->{'reference'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 3040 | ▶ | sub obsolete { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
obsolete: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 3040 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 3040 | ▶ | @_ ? $self->{'obsolete'} = shift : $self->{'obsolete'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 1 | ▶ | sub fuzzy { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fuzzy: called CC=3 SCAR=11.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 1 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 1 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 1 | ▶ | $value ? $self->add_flag('fuzzy') : $self->remove_flag('fuzzy'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 1 | return $self->has_flag('fuzzy'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub c_format { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
c_format: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return $self->_tri_value_flag('c-format', @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | sub php_format { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
php_format: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | return $self->_tri_value_flag('php-format', @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 5775 | ▶ | sub _flags { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_flags: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 5775 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 5775 | ▶ | @_ ? $self->{'_flags'} = shift : $self->{'_flags'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub _tri_value_flag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_tri_value_flag: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | my $flag_name = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if (@_) { # set or clear the flags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my $value = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | ▶ | if (!defined($value) || $value eq "") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
not defined $value or $value eq ""
MC/DC0%0/2
not defined $value or $value eq ""
not defined $value
$value eq ""
Truth table0%0/3
not(A) or B
A= not defined $valueB= $value eq ""
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | $self->remove_flag("$flag_name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | $self->remove_flag("no-$flag_name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | elsif ($value) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $self->add_flag("$flag_name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $self->remove_flag("no-$flag_name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $self->add_flag("no-$flag_name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | $self->remove_flag("$flag_name"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | else { # check the flags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | ▶ | return 1 if $self->has_flag("$flag_name"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | return 0 if $self->has_flag("no-$flag_name"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 1144 | ▶ | sub add_flag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_flag: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 1144 | my ($self, $flag_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 1144 | ▶ | if (! $self->has_flag($flag_name)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 1143 | push @{$self->_flags}, $flag_name; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1144 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | ▶ | sub remove_flag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
remove_flag: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | my ($self, $flag_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my @new_flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | foreach my $flag (@{$self->_flags}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | push @new_flags, $flag unless $flag eq $flag_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $self->_flags(\@new_flags); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 1147 | ▶ | sub has_flag { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_flag: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 1147 | my ($self, $flag_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 1147 | foreach my $flag (@{$self->_flags}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 210 | ▶ | return 1 if $flag eq $flag_name; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 1143 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 1967 | ▶ | sub loaded_line_number { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
loaded_line_number: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 1967 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 1967 | ▶ | @_ ? $self->{'loaded_line_number'} = shift : $self->{'loaded_line_number'}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 3158 | ▶ | sub _normalize_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_normalize_str: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 3158 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 3158 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 3158 | my $dequoted = $self->dequote($string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # Multiline: this isn't quite perfect, but fast and easy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 3158 | ▶ | if (defined $dequoted && $dequoted =~ /\n/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $dequoted and $dequoted =~ /\n/
MC/DC50%1/2
defined $dequoted and $dequoted =~ /\n/
defined $dequoted
$dequoted =~ /\n/
Truth table66%2/3
A and B
A= defined $dequotedB= $dequoted =~ /\n/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 200 | my $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | my @lines; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 200 | @lines = split(/\n/, $dequoted, -1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 200 | my $lastline = pop @lines; # special treatment for this one | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 200 | ▶ | $output = qq{""\n} if ($#lines != 0); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | 200 | foreach (@lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 353 | $output .= $self->quote("$_\n") . "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | 200 | ▶ | $output .= $self->quote($lastline) . "\n" if $lastline ne ""; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 200 | return $output; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | # Single line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 2958 | ▶ | return ($string || "") . "\n"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$string || ''
MC/DC0%0/1
$string || ''
$string
Truth table50%1/2
A
A= $string
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 112 | ▶ | sub _fuzzy_normalize_str { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_fuzzy_normalize_str: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | 112 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 112 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 112 | my $prefix = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 112 | my $normalized = $self->_normalize_str($string); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | # on newlines, start them with "#| " or "#~| " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 112 | $normalized =~ s/\n"/\n$prefix"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 112 | return $normalized; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 1513 | ▶ | sub dump { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: called CC=16 SCAR=27.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 1513 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | 1513 | ▶ | my $obsolete = $self->obsolete ? '#~ ' : ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 1513 | ▶ | my $fuzzy_prefix = $self->obsolete ? '#~| ' : '#| '; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | 1513 | my $dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 1513 | ▶ | $dump = $self->_dump_multi_comment($self->comment, "# ") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | if ($self->comment); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 1513 | ▶ | $dump .= $self->_dump_multi_comment($self->automatic, "#. ") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | if ($self->automatic); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1513 | ▶ | $dump .= $self->_dump_multi_comment($self->reference, "#: ") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | if ($self->reference); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 1513 | my $flags = ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | 1513 | foreach my $flag (@{$self->_flags}) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 589 | $flags .= ", $flag"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 1513 | ▶ | $dump .= "#$flags\n" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | if length $flags; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 1513 | ▶ | $dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | .= "${fuzzy_prefix}msgctxt " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | . $self->_fuzzy_normalize_str($self->fuzzy_msgctxt, $fuzzy_prefix) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | if $self->fuzzy_msgctxt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 1513 | ▶ | $dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | .= "${fuzzy_prefix}msgid " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | . $self->_fuzzy_normalize_str($self->fuzzy_msgid, $fuzzy_prefix) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | if $self->fuzzy_msgid; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 1513 | ▶ | $dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | .= "${fuzzy_prefix}msgid_plural " | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | . $self->_fuzzy_normalize_str($self->fuzzy_msgid_plural, $fuzzy_prefix) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | if $self->fuzzy_msgid_plural; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 1513 | ▶ | $dump .= "${obsolete}msgctxt " . $self->_normalize_str($self->msgctxt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | if $self->msgctxt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 1513 | $dump .= "${obsolete}msgid " . $self->_normalize_str($self->msgid); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | 1513 | ▶ | $dump .= "${obsolete}msgid_plural " . $self->_normalize_str($self->msgid_plural) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | if $self->msgid_plural; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 1513 | ▶ | $dump .= "${obsolete}msgstr " . $self->_normalize_str($self->msgstr) if $self->msgstr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 1513 | ▶ | if (my $msgstr_n = $self->msgstr_n) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | $dump .= "${obsolete}msgstr[$_] " . $self->_normalize_str($$msgstr_n{$_}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 9 | for sort { $a <=> $b } keys %$msgstr_n; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 1513 | $dump .= "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 1513 | return $dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | 1494 | ▶ | sub _dump_multi_comment { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dump_multi_comment: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 1494 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 1494 | my $comment = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 1494 | my $leader = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1494 | my $chopped = $leader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 1494 | chop($chopped); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 1494 | my $result = $leader . $comment; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 1494 | $result =~ s/\n/\n$leader/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 1494 | $result =~ s/^$leader$/$chopped/gm; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 1494 | $result .= "\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 1494 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # Quote a string properly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 4530 | ▶ | sub quote { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quote: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 4530 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 4530 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | return undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 4530 | ▶ | unless defined $string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 4529 | $string =~ s/\\(?!t)/\\\\/g; # \t is a tab | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | 4529 | $string =~ s/"/\\"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 4529 | $string =~ s/\n/\\n/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 4529 | return "\"$string\""; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 7497 | ▶ | sub dequote { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dequote: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 7497 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | 7497 | my $string = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | return undef | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 7497 | ▶ | unless defined $string; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 7497 | $string =~ s/^"(.*)"/$1/; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 7497 | $string =~ s/\\"/"/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 7497 | $string =~ s/(?<!(\\))\\n/\n/g; # newline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 7497 | $string =~ s/(?<!(\\))\\{2}n/\\n/g; # inline newline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | 7497 | $string =~ s/(?<!(\\))\\{3}n/\\\n/g; # \ followed by newline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 7497 | $string =~ s/\\{4}n/\\\\n/g; # \ followed by inline newline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 7497 | $string =~ s/\\\\(?!n)/\\/g; # all slashes not related to a newline | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 7497 | return $string; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 10 | ▶ | sub save_file_fromarray { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save_file_fromarray: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 10 | $self->_save_file(0, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | sub save_file_fromhash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
save_file_fromhash: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | $self->_save_file(1, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 10 | ▶ | sub _save_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_save_file: called CC=6 SCAR=18.6
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 10 | my $ashash = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 10 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | 10 | my $entries = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 10 | my $encoding = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 10 | ▶ | open(OUT, defined($encoding) ? ">:encoding($encoding)" : ">", $file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 10 | ▶ | if ($ashash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | foreach (sort keys %$entries) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | print OUT $entries->{$_}->dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 10 | foreach (@$entries) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 1499 | print OUT $_->dump; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | 10 | close OUT; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 14 | ▶ | sub load_file_asarray { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_file_asarray: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | 14 | $self->_load_file(0, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | sub load_file_ashash { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_file_ashash: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | $self->_load_file(1, @_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 14 | ▶ | sub _load_file { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_load_file: called CC=60 SCAR=43.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 14 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 14 | my $ashash = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 14 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 14 | my $encoding = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 14 | ▶ | my $class = ref $self || $self; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table33%1/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 14 | my (@entries, %entries); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 14 | my $line_number = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 14 | my $po; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | my %buffer; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | 14 | my $last_buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | 14 | ▶ | open(IN, defined($encoding) ? "<:encoding($encoding)" : "<", $file) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | or return undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 14 | ▶ | while (<IN>) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 9214 | chomp; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 9214 | $line_number++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | # Strip trailing \r\n chars | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | # This can possibly have an effect only on msys (on which chomp | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | # seems to leave some trailing \r chars) and on MacOS that has | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | # reversed newline (\n\r). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | # Note that our stripping of those trailing chars is only going to be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | # useful when writing from one platform and reading on another. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 9214 | s{[\r\n]*$}{}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 9214 | ▶ | if (/^$/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 14 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | # Empty line. End of an entry. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 1960 | ▶ | if (defined($po)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | $po->fuzzy_msgctxt($buffer{fuzzy_msgctxt}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 1960 | ▶ | if defined $buffer{fuzzy_msgctxt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | 1960 | ▶ | $po->fuzzy_msgid($buffer{fuzzy_msgid}) if defined $buffer{fuzzy_msgid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | $po->fuzzy_msgid_plural($buffer{fuzzy_msgid_plural}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 1960 | ▶ | if defined $buffer{fuzzy_msgid_plural}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 1960 | ▶ | $po->msgctxt($buffer{msgctxt}) if defined $buffer{msgctxt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 1960 | ▶ | $po->msgid($buffer{msgid}) if defined $buffer{msgid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 1960 | ▶ | $po->msgid_plural($buffer{msgid_plural}) if defined $buffer{msgid_plural}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 1960 | ▶ | $po->msgstr($buffer{msgstr}) if defined $buffer{msgstr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 1960 | ▶ | $po->msgstr_n($buffer{msgstr_n}) if defined $buffer{msgstr_n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | # ashash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 1960 | ▶ | if ($ashash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | ▶ | $entries{$po->msgid} = $po | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | if ($po->_hash_key_ok(\%entries)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | # asarray | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 1960 | push(@entries, $po); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 1960 | undef $po; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1960 | undef $last_buffer; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 1960 | %buffer = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | ▶ | elsif (/^#\s+(.*)/ or /^#()$/) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
/^#\s+(.*)/ or /^#()$/
MC/DC100%2/2
/^#\s+(.*)/ or /^#()$/
/^#\s+(.*)/
/^#()$/
Truth table100%3/3
A or B
A= /^#\s+(.*)/B= /^#()$/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | # Translator comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 34 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 34 | ▶ | if (defined($po->comment)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 25 | $po->comment($po->comment . "\n$1"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 9 | $po->comment($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | elsif (/^#\.\s*(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # Automatic comments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 914 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 914 | ▶ | if (defined($po->automatic)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | $po->automatic($po->automatic . "\n$1"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 914 | $po->automatic($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | elsif (/^#:\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 1029 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | 1029 | ▶ | if (defined($po->reference)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 2 | $po->reference($po->reference . "\n$1"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 1027 | $po->reference($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | elsif (/^#,\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | # flags | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 938 | my @flags = split /\s*[,]\s*/, $1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 938 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 938 | foreach my $flag (@flags) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 1142 | $po->add_flag($flag); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | elsif (/^#(~)?\|\s+msgctxt\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 1 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 1 | $buffer{fuzzy_msgctxt} = $self->dequote($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 1 | $last_buffer = \$buffer{fuzzy_msgctxt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 1 | ▶ | $po->obsolete(1) if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | elsif (/^#(~)?\|\s+msgid\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 206 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 206 | $buffer{fuzzy_msgid} = $self->dequote($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 206 | $last_buffer = \$buffer{fuzzy_msgid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 206 | ▶ | $po->obsolete(1) if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | elsif (/^#(~)?\|\s+msgid_plural\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 1 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 1 | $buffer{fuzzy_msgid_plural} = $self->dequote($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | 1 | $last_buffer = \$buffer{fuzzy_msgid_plural}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 1 | ▶ | $po->obsolete(1) if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | elsif (/^(#~\s+)?msgctxt\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 4 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 4 | $buffer{msgctxt} = $self->dequote($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 4 | $last_buffer = \$buffer{msgctxt}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 4 | ▶ | $po->obsolete(1) if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | elsif (/^(#~\s+)?msgid\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 1965 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 1965 | $buffer{msgid} = $self->dequote($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 1965 | $last_buffer = \$buffer{msgid}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 1965 | ▶ | $po->obsolete(1) if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | elsif (/^(#~\s+)?msgid_plural\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 5 | ▶ | $po = $class->new(-loaded_line_number => $line_number) unless defined($po); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | 5 | $buffer{msgid_plural} = $self->dequote($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 5 | $last_buffer = \$buffer{msgid_plural}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | 5 | ▶ | $po->obsolete(1) if $1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | elsif (/^(?:#~\s+)?msgstr\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # translated string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 1959 | $buffer{msgstr} = $self->dequote($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 1959 | $last_buffer = \$buffer{msgstr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | elsif (/^(?:#~\s+)?msgstr\[(\d+)\]\s+(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # translated string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 10 | $buffer{msgstr_n}{$1} = $self->dequote($2); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | 10 | $last_buffer = \$buffer{msgstr_n}{$1}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | elsif (/^(?:#(?:~|~\||\|)\s+)?(".*)/) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # continued string. Accounts for: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # normal : "string" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # obsolete : #~ "string" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | # fuzzy : #| "string" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | # fuzzy+obsolete : #~| "string" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 188 | $$last_buffer .= $self->dequote($1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | warn "Strange line at $file line $line_number: [$_]\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | 14 | ▶ | if (defined($po)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | $po->msgctxt($buffer{msgctxt}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 5 | ▶ | if defined $buffer{msgctxt}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | $po->msgid($buffer{msgid}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 5 | ▶ | if defined $buffer{msgid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | $po->msgid_plural($buffer{msgid_plural}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | 5 | ▶ | if defined $buffer{msgid_plural}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | $po->msgstr($buffer{msgstr}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | 5 | ▶ | if defined $buffer{msgstr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | $po->msgstr_n($buffer{msgstr_n}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 5 | ▶ | if defined $buffer{msgstr_n}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | # ashash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 5 | ▶ | if ($ashash) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | if ($po->_hash_key_ok(\%entries)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $entries{$po->msgid} = $po; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | # asarray | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 5 | push(@entries, $po); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | 14 | close IN; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 14 | ▶ | return ($ashash ? \%entries : \@entries); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | sub _hash_key_ok { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_hash_key_ok: not called CC=6 SCAR=37.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 0 | my ($self, $entries) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 0 | my $key = $self->msgid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | if ($entries->{$key}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | # don't overwrite non-obsolete entries with obsolete ones | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | ▶ | return if (($self->obsolete) && (not $entries->{$key}->obsolete)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->obsolete and not $entries->{$key}->obsolete
MC/DC0%0/2
$self->obsolete and not $entries->{$key}->obsolete
$self->obsolete
not $entries->{$key}->obsolete
Truth table0%0/3
A and not(B)
A= $self->obsoleteB= not $entries->{$key}->obsolete
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | # don't overwrite translated entries with untranslated ones | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | ▶ | return if (($self->msgstr !~ /\w/) && ($entries->{$key}->msgstr =~ /\w/)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $self->msgstr =~ /\w/ and $entries->{$key}->msgstr =~ /\w/
MC/DC0%0/2
not $self->msgstr =~ /\w/ and $entries->{$key}->msgstr =~ /\w/
not $self->msgstr =~ /\w/
$entries->{$key}->msgstr =~ /\w/
Truth table0%0/3
not(A) and B
A= not $self->msgstr =~ /\w/B= $entries->{$key}->msgstr =~ /\w/
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | # Autoload methods go after =cut, and are processed by the autosplit program. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | 9 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||