| 1 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | ## PO Files Manipulation - ~/lib/Text/PO/Element.pm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | ## Version v0.4.2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | ## Copyright(c) 2025 DEGUEST Pte. Ltd. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | ## Author: Jacques Deguest <jack@deguest.jp> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | ## Created 2021/07/23 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | ## Modified 2025/12/05 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | ## All rights reserved | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | ## | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | ## This program is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | ## under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | ##---------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | package Text::PO::Element; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | BEGIN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 6 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use parent qw( Module::Generic ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use vars qw( $VERSION ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | use overload ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | '==' => sub { _obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | '!=' => sub { !_obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | 'eq' => sub { _obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 18 | ▶ | 'ne' => sub { !_obj_eq(@_) }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 6 | fallback => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 6 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 6 | ▶ | use Text::Wrap (); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | our $VERSION = 'v0.4.2'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 6 | ▶ | use open ':std' => ':utf8'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | $Text::Wrap::columns = 80; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | sub init | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 99 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 99 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 99 | $self->{msgid} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 99 | $self->{msgstr} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 99 | $self->{msgid_plural} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 99 | $self->{context} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 99 | $self->{fuzzy} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 99 | $self->{comment} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 99 | $self->{auto_comment} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | # e.g.: c-format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 99 | $self->{flags} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # Is it plural? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 99 | $self->{plural} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | # reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 99 | $self->{file} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 99 | $self->{line} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 99 | $self->{encoding} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # Parent po object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 99 | $self->{po} = undef; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # Whether this element is actually just an include directive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # If it is, the include file value is stored in the comment | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 99 | $self->{is_include} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 99 | $self->{is_meta} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 99 | $self->{_po_line} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 99 | $self->{_init_strict_use_sub} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 99 | $self->SUPER::init( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 99 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 1 | ▶ | sub add_auto_comment { return( shift->_add( 'auto_comment', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_auto_comment: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 5 | ▶ | sub add_comment { return( shift->_add( 'comment', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_comment: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | 12 | ▶ | sub add_msgid { return( shift->_add( 'msgid', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_msgid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | sub add_msgid_plural { return( shift->_add( 'msgid_plural', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_msgid_plural: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 63 | ▶ | sub add_msgstr { return( shift->_add( 'msgstr', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_msgstr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | sub add_reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_reference: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | ## If there is any existing value, convert it to array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | ▶ | $self->{file} = [$self->{file}] if( length( $self->{file} ) && $self->_is_array( $self->{file} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length $self->{"file"} and $self->_is_array($self->{"file"})
MC/DC0%0/2
length $self->{"file"} and $self->_is_array($self->{"file"})
length $self->{"file"}
$self->_is_array($self->{"file"})
Truth table0%0/3
A and B
A= length $self->{"file"}B= $self->_is_array($self->{"file"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $self->{line} = [$self->{line}] if( length( $self->{line} ) && $self->_is_array( $self->{line} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length $self->{"line"} and $self->_is_array($self->{"line"})
MC/DC0%0/2
length $self->{"line"} and $self->_is_array($self->{"line"})
length $self->{"line"}
$self->_is_array($self->{"line"})
Truth table0%0/3
A and B
A= length $self->{"line"}B= $self->_is_array($self->{"line"})
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | if( $self->_is_array( $_[0] ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | push( @{$self->{file}}, $_[0]->[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | push( @{$self->{line}}, $_[0]->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | push( @{$self->{file}}, shift( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | push( @{$self->{line}}, shift( @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub auto_comment { return( shift->_set_get_array( 'auto_comment', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
auto_comment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 8 | ▶ | sub comment { return( shift->_set_get_array( 'comment', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
comment: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 19 | ▶ | sub context { return( shift->_set_get_scalar( 'context', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
context: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | sub delete | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my $po = $self->po; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | return( $self->error( "No Text::PO object set." ) ) if( !$po ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | return( $po->remove_element( $self ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | sub dump | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: called CC=16 SCAR=41.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 8 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 8 | my @res = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 8 | ▶ | if( $self->is_include ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | ▶ | push( @res, '# ' . join( "\n# ", @{$self->{comment}} ) ) if( scalar( @{$self->{comment}} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | push( @res, '#. $include "' . $self->{file} . '"' ) if( length( $self->{file} // '' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"file"} // ""
MC/DC0%0/1
$self->{"file"} // ""
$self->{"file"}
Truth table0%0/2
A
A= $self->{"file"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | push( @res, '# ' . join( "\n# ", @{$self->{comment}} ) ) if( scalar( @{$self->{comment}} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | ▶ | push( @res, '#. ' . join( "\n#. ", @{$self->{auto_comment}} ) ) if( scalar( @{$self->{auto_comment}} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 8 | my $ref = $self->reference; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 8 | ▶ | push( @res, "#: $ref" ) if( length( $ref ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 8 | my $flags = $self->flags; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 8 | ▶ | if( scalar( @$flags ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | push( @res, sprintf( '#, %s', join( ", ", @$flags ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 8 | ▶ | push( @res, sprintf( 'msgctxt "%s"', $self->po->quote( $self->{context} ) ) ) if( length( $self->{context} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 8 | foreach my $k ( qw( msgid msgid_plural ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 16 | ▶ | if( $self->can( "${k}_as_string" ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 16 | my $sub = "${k}_as_string"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 16 | push( @res, $self->$sub() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | ▶ | if( ref( $self->{ $k } ) && scalar( @{$self->{ $k }} ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
ref $self->{$k} and scalar @{$self->{$k};}
MC/DC0%0/1
ref $self->{$k} and scalar @{$self->{$k};}
ref $self->{$k}
Truth table0%0/2
A
A= ref $self->{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | push( @res, sprintf( '%s ""', $k ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | push( @res, map( sprintf( '"%s"', $self->po->quote( $_ ) ), @{$self->{ $k }} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ▶ | elsif( !ref( $self->{ $k } ) && length( $self->{ $k } ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
not ref $self->{$k} and length $self->{$k}
MC/DC0%0/2
not ref $self->{$k} and length $self->{$k}
not ref $self->{$k}
length $self->{$k}
Truth table0%0/3
not(A) and B
A= not ref $self->{$k}B= length $self->{$k}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | push( @res, sprintf( '%s "%s"', $k, $self->po->quote( $self->{ $k } ) ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 8 | push( @res, $self->msgstr_as_string ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 8 | return( join( "\n", @res ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 28 | ▶ | sub encoding { return( shift->_set_get_scalar( 'encoding', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
encoding: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 1 | ▶ | sub file { return( shift->_set_get_scalar( 'file', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
file: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 16 | ▶ | sub flags { return( shift->_set_get_array( 'flags', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
flags: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | ▶ | sub fuzzy { return( shift->_set_get_boolean( 'fuzzy', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fuzzy: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | sub id | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 107 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
id: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 107 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 107 | my $msgid = $self->msgid; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 107 | ▶ | if( ref( $msgid ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 6 | return( CORE::join( '', @$msgid ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 101 | return( $msgid ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 80 | ▶ | sub is_include { return( shift->_set_get_boolean( 'is_include', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_include: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 60 | ▶ | sub is_meta { return( shift->_set_get_boolean( 'is_meta', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_meta: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | sub line { return( shift->_set_get_number( 'line', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
line: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | sub merge | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
merge: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | my $elem = shift( @_ ) || return( $self->error( "No element object was provided." ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift @_ || (return $self->error('No element object was provided.'))
MC/DC0%0/1
shift @_ || (return $self->error('No element object was provided.'))
shift @_
Truth table0%0/2
A
A= shift @_
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | return( $self->error( "Object provided ($elem) is not an Text::PO::Element object" ) ) if( !$self->_is_object( $elem ) || !$elem->isa( 'Text::PO::Element' ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->_is_object($elem) and $elem->isa("Text::PO::Element")
MC/DC0%0/2
$self->_is_object($elem) and $elem->isa("Text::PO::Element")
$self->_is_object($elem)
$elem->isa("Text::PO::Element")
Truth table0%0/3
A and B
A= $self->_is_object($elem)B= $elem->isa("Text::PO::Element")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | my @k = grep( !/^po$/, keys( %$elem ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | foreach( @k ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | $self->{ $_ } = $elem->{ $_ } if( !length( $self->{ $_ } ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 196 | ▶ | sub msgid { return( shift->_set_get( 'msgid', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | sub msgid_as_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid_as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | 8 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 8 | return( $self->normalise( 'msgid', $self->{msgid} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | sub msgid_as_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 135 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid_as_text: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 135 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 135 | ▶ | my $msgid = $self->_is_array( $self->{msgid} ) ? join( '', @{$self->{msgid}} ) : $self->{msgid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 135 | return( $msgid ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 8 | ▶ | sub msgid_plural { return( shift->_set_get( 'msgid_plural', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid_plural: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | sub msgid_plural_as_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid_plural_as_string: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 16 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | # Important to return undef and not an empty string if there is no plural msgid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | # undef will not be added to the list, but empty string would | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 16 | ▶ | return if( !CORE::length( $self->{msgid_plural} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 2 | return( $self->normalise( 'msgid_plural', $self->{msgid_plural} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | sub msgid_plural_as_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 16 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgid_plural_as_text: called CC=2 SCAR=7.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 16 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | # Important to return undef and not an empty string if there is no plural msgid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # undef will not be added to the list, but empty string would | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | my $msgid = $self->_is_array( $self->{msgid_plural} ) ? join( '', @{$self->{msgid_plural}} ) : $self->{msgid_plural}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 16 | return( $msgid ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | sub msgstr | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 167 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgstr: called CC=8 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 167 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 167 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 89 | ▶ | if( @_ == 2 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 13 | my( $pos, $str ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 13 | ▶ | return( $self->error( "msgstr plural offset \"$pos\" is not an integer." ) ) if( $pos !~ /^\d+$/ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | 13 | $pos = int( $pos ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 13 | ▶ | $self->{msgstr} = [] if( ref( $self->{msgstr} ) ne 'ARRAY' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | 13 | ▶ | $self->{msgstr}->[ $pos ] = [] if( ref( $self->{msgstr}->[ $pos ] ) ne 'ARRAY' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 13 | push( @{$self->{msgstr}->[ $pos ]}, $str ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 76 | ▶ | if( !ref( $_[0] ) && defined( $_[0] ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not ref $_[0] and defined $_[0]
MC/DC50%1/2
not ref $_[0] and defined $_[0]
not ref $_[0]
defined $_[0]
Truth table66%2/3
not(A) and B
A= not ref $_[0]B= defined $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | 73 | chomp( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 76 | $self->{msgstr} = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 167 | return( $self->{msgstr} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | sub msgstr_as_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 8 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgstr_as_string: called CC=5 SCAR=16.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 8 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 8 | my @res = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 8 | ▶ | if( $self->plural ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 1 | ▶ | for( my $i = 0; $i < scalar( @{$self->{msgstr}} ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 2 | my $ref = $self->{msgstr}->[$i]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | # Is this a multiline plural localised text? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # msgstr[0] "" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | # "some long line text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | # "2nd line of localised text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 2 | ▶ | if( scalar( @$ref ) > 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | push( @res, sprintf( 'msgstr[%d] ""', $i ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 0 | push( @res, map( sprintf( '"%s"', $self->po->quote( $_ ) ), @$ref ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | # Regular plural localised text msgstr[0] "some text" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | 2 | ▶ | push( @res, sprintf( 'msgstr[%d] "%s"', $i, $self->po->quote( $ref->[0] ) ) ) if( length( $ref->[0] ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 1 | return( join( "\n", @res ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | 7 | return( $self->normalise( 'msgstr', $self->{msgstr} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | sub msgstr_as_text | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
msgstr_as_text: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 17 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | 17 | ▶ | my $msgstr = $self->_is_array( $self->{msgstr} ) ? join( '', @{$self->{msgstr}} ) : $self->{msgstr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | 17 | return( $msgstr ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | sub normalise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
normalise: called CC=8 SCAR=21.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 17 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 17 | my $type = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | 17 | my $text = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 17 | my @res = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 17 | my $lines; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 17 | ▶ | if( ref( $text ) && scalar( @$text ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%2/2
ref $text and scalar @$text
MC/DC100%1/1
ref $text and scalar @$text
ref $text
Truth table100%2/2
A
A= ref $text
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | $lines = $self->wrap( join( '', @$text ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | ▶ | elsif( !ref( $text ) && length( $text ) ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
not ref $text and length $text
MC/DC0%0/2
not ref $text and length $text
not ref $text
length $text
Truth table33%1/3
not(A) and B
A= not ref $textB= length $text
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 15 | $lines = $self->wrap( $text ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 17 | ▶ | if( defined( $lines ) && scalar( @$lines ) > 1 ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $lines and scalar @$lines > 1
MC/DC50%1/2
defined $lines and scalar @$lines > 1
defined $lines
scalar @$lines > 1
Truth table66%2/3
A and B
A= defined $linesB= scalar @$lines > 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | push( @res, sprintf( '%s ""', $type ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 2 | push( @res, map( sprintf( '"%s"', $_ ), @$lines ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 15 | ▶ | push( @res, sprintf( '%s "%s"', $type, ( defined( $lines ) ? $lines->[0] : '' ) ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 17 | return( join( "\n", @res ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 50 | ▶ | sub plural { return( shift->_set_get_boolean( 'plural', @_ ) ); } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
plural: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | 140 | ▶ | sub po { return( shift->_set_get_object( 'po', 'Text::PO', @_ ) ); }# | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
po: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | sub reference | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 31 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reference: called CC=13 SCAR=39.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 31 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 31 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 15 | ▶ | if( $self->_is_array( $_[0] ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | # Multi references: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | # colorscheme.cpp:79 skycomponents/equator.cpp:31 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | if( $self->_is_array( $_[0]->[0] ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | $self->{file} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | $self->{line} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | foreach my $a ( @{$_[0]} ) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | push( @{$self->{file}}, $a->[0] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | push( @{$self->{line}}, $a->[1] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | @$self{ qw( file line ) } = @{$_[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 15 | @$self{ qw( file line ) } = split( /:/, shift( @_ ), 2 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 31 | ▶ | return( '' ) if( !length( $self->{file} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | ▶ | return( '' ) if( $self->_is_array( $self->{file} ) && !scalar( @{$self->{file}} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->_is_array($self->{"file"}) and not scalar @{$self->{"file"};}
MC/DC0%0/2
$self->_is_array($self->{"file"}) and not scalar @{$self->{"file"};}
$self->_is_array($self->{"file"})
not scalar @{$self->{"file"};}
Truth table33%1/3
A and not(B)
A= $self->_is_array($self->{"file"})B= not scalar @{$self->{"file"};}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 21 | ▶ | if( $self->_is_array( $self->{file} ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my @temp = (); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | for( my $i = 0; $i < scalar( @{$self->{file}} ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 0 | ▶ | push( @temp, join( ':', $self->{file}->[$i], ( $self->_is_array( $self->{line} ) ? ( $self->{line}->[$i] // '' ) : '' ) ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$self->{"line"}[$i] // ""
MC/DC0%0/1
$self->{"line"}[$i] // ""
$self->{"line"}[$i]
Truth table0%0/2
A
A= $self->{"line"}[$i]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | return( join( ' ', @temp ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 21 | ▶ | return( join( ':', $self->{file}, ( $self->{line} // '' ) ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{"line"} // ""
MC/DC100%1/1
$self->{"line"} // ""
$self->{"line"}
Truth table100%2/2
A
A= $self->{"line"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | sub wrap | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | 17 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 17 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 17 | my $text = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | 17 | my $max = 80; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 17 | ▶ | if( length( $text ) > $max ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | 2 | my $lines = [split( /\n/, $text )]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 2 | ▶ | for( my $i = 0; $i < scalar( @$lines ); $i++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 2 | ▶ | if( length( $lines->[$i] ) > $max ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 2 | my $newLines = $self->wrap_line( $lines->[$i] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 2 | splice( @$lines, $i, 1, @$newLines ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 2 | $i += scalar( @$newLines ) - 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | $lines->[$i] = $self->po->quote( $lines->[$i] . "\n" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 2 | return( $lines ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | 15 | return( [ $self->po->quote( $text ) ] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | sub wrap_line | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 2 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
wrap_line: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 2 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 2 | my $text = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 2 | ▶ | return( [] ) if( !length( $text ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 2 | my $new = Text::Wrap::wrap( '', '', $text ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 2 | my $newLines = [split( /\n/, $new )]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | 2 | ▶ | for( my $j = 0; $j < scalar( @$newLines ); $j++ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 4 | ▶ | $newLines->[$j] .= ' ' unless( $j == $#${newLines} ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | 4 | $newLines->[$j] = $self->po->quote( $newLines->[$j] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | #$newLines->[ $#${newLines} ] = $self->po->quote( $newLines->[ $#${newLines} ] ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 2 | return( $newLines ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | sub _add | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | 81 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_add: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 81 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 81 | my $what = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | #chomp( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 81 | ▶ | $self->{ $what } = [] if( !ref( $self->{ $what } ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 81 | push( @{$self->{ $what }}, @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 81 | return( $self ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | sub _obj_eq | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 18 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_obj_eq: called CC=16 SCAR=33.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | 6 | ▶ | no overloading; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 18 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 18 | my $other = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 18 | ▶ | my $msgid = $self->_is_array( $self->{msgid} ) ? join( '', @{$self->{msgid}} ) : $self->{msgid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 18 | ▶ | if( $self->_is_a( $other => 'Text::PO::Element' ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 18 | ▶ | my $msgstr = $self->_is_array( $self->{msgstr} ) ? join( '', @{$self->{msgstr}} ) : $self->{msgstr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | 18 | ▶ | my $other_msgid = $self->_is_array( $other->{msgid} ) ? join( '', @{$other->{msgid}} ) : $other->{msgid}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 18 | ▶ | my $other_msgstr = $self->_is_array( $other->{msgstr} ) ? join( '', @{$other->{msgstr}} ) : $other->{msgstr}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | 18 | ▶ | return( ( ( $msgid // '' ) eq ( $other_msgid // '' ) && ( $msgstr // '' ) eq ( $other_msgstr // '' ) ) ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition45%5/11
($msgid // "") eq ($other_msgid // "") and ($msgstr // "") eq ($other_msgstr // "")
$msgid // ""
$other_msgid // ""
$msgstr // ""
$other_msgstr // ""
MC/DC0%0/2
($msgid // "") eq ($other_msgid // "") and ($msgstr // "") eq ($other_msgstr // "")
$msgid
$msgstr
MC/DC100%1/1
$other_msgid // ""
$other_msgid
MC/DC0%0/1
$other_msgstr // ""
$other_msgstr
Truth table33%1/3
A and B
A= $msgidB= $msgstr
Truth table100%2/2
A
A= $other_msgid
Truth table0%0/2
A
A= $other_msgstr
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | # Comparing an undefined value would trigger a Perl warning | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | elsif( !defined( $other ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | ▶ | return( !defined( $msgid ) ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | return( ( $msgid // '' ) eq $other ? 1 : 0 ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$msgid // ""
MC/DC0%0/1
$msgid // ""
$msgid
Truth table0%0/2
A
A= $msgid
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | sub _set_get | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | 204 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_get: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 204 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 204 | my $name = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | 204 | ▶ | if( @_ ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 85 | ▶ | if( !ref( $_[0] ) && length( $_[0] ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not ref $_[0] and length $_[0]
MC/DC50%1/2
not ref $_[0] and length $_[0]
not ref $_[0]
length $_[0]
Truth table66%2/3
not(A) and B
A= not ref $_[0]B= length $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 63 | chomp( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 85 | ▶ | $self->plural(1) if( $name eq 'msgid_plural' ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 85 | return( $self->SUPER::_set_get( $name, @_ ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 119 | return( $self->SUPER::_set_get( $name ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | sub _set_get_msg_property | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | ▶ | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_set_get_msg_property: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | my $self = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my $prop = shift( @_ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | $self->_set_get( $prop, @_ ) if( @_ ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | if( ref( $self->{ $prop } ) ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | ▶ | return( wantarray() ? ( @{$self->{ $prop }} ) : join( '', @{$self->{ $prop }} ) ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | ▶ | return( wantarray() ? ( $self->{ $prop } ) : $self->{ $prop } ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | # NOTE: POD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||