Branch Coverage

lib/Locale/Maketext/Utils.pm
Criterion Covered Total %
branch 296 448 66.0


line true false branch
23 28 170 if ref $compiled ne 'CODE'
29 188 2 if defined $_
45 5 28 if substr($arg, 0, 2) =~ /i[-_]/
48 7 21 unless $loc
61 21 31 if (exists $singleton_stash{$class}{$args_sig}) { }
75 10 12 unless (exists $lh->{'Locales.pm'}{$tag})
94 30 1 unless $ENV{'maketext_obj_skip_env'}
102 29 33 if (defined ${$ns . '::Encoding';})
103 29 0 if ${$ns . '::Encoding';}
115 1 125 if (exists $lh->{'_get_key_from_lookup'})
116 1 0 if (ref $lh->{'_get_key_from_lookup'} eq 'CODE')
121 1 125 if defined $lookup
123 1 124 if (exists $lh->{'_log_phantom_key'})
124 1 0 if (ref $lh->{'_log_phantom_key'} eq 'CODE')
129 0 125 if ($lh->{'use_external_lex_cache'}) { }
133 0 0 if ($key =~ /^_/s)
143 0 125 if ($key =~ /^_/s)
155 1 2 if not @args and ref $phrase eq 'ARRAY'
182 19 64 if ($type eq 'SCALAR') { }
64 0 elsif ($type eq 'CODE') { }
206 0 10 unless $ns =~ / \A \w+ (::\w+)* \z /msx
207 8 2 $is_base_class ? :
210 7 3 ref $pkgs ? :
211 0 23 unless $pkg =~ / \A \w+ (::\w+)* \z /msx
224 2 63 if exists $lex_hr->{$key}
237 0 1 if ref $appendage ne 'HASH'
241 1 1 $lang eq '_' ? :
256 3 4 $wants_tag eq $has_tag ? :
276 0 0 !(defined $/ && $/) ? :
277 0 0 if $text
283 0 1 !(defined $/ && $/) ? :
284 1 0 if $text
292 0 0 $in_locale_tongue ? :
300 0 0 if ($is_tag) { }
307 0 0 if ($raw_cldr eq 'left-to-right') { }
0 0 elsif ($raw_cldr eq 'right-to-left') { }
344 0 6 unless @_ == 2
347 0 6 unless defined $handle and defined $phrase
349 0 6 unless ($handle->{'use_external_lex_cache'})
367 4 4 if (exists $h_r->{$phrase}) { }
0 4 elsif (not $phrase =~ /^_/s and $h_r->{'_AUTO'}) { }
369 0 4 if (ref $h_r->{$phrase})
393 2 4 unless (defined $value)
399 2 4 if not defined $value or $value eq ''
406 2 3 unless (@langcodes)
413 1 1 if (ref $lh->{'_lang_pm_search_paths'} eq 'ARRAY')
417 1 1 unless @search
422 13 2 unless -d $lookin
423 2 0 if (opendir my $dh, $lookin)
427 0 2 unless $pm
428 0 2 if $pm eq 'Utils'
441 1 4 wantarray && $Locales::VERSION > 0.06 ? :
442 1 4 wantarray && $Locales::VERSION > 0.09 ? :
448 4 13 if (defined $native)
452 4 13 if (defined $direction)
457 1 4 wantarray ? :
466 3 2 unless $lh->langtag_is_loadable($tag)
474 0 1 if (@_ == 3)
480 1 0 $lh->get_language_tag eq $langtag ? :
483 0 1 if (my $ref = tied %{$ns . '::Lexicon';})
484 0 0 if $lh->{'add_lex_hash_silent_if_already_added'} and exists $ref->{'hashes'} and exists $ref->{'hashes'}{$name}
485 0 0 if ($ref->can('add_lookup_override_hash'))
491 0 1 if (eval { do { require Sub::Todo } }) { }
502 0 1 if (@_ == 3)
508 1 0 $lh->get_language_tag eq $langtag ? :
511 0 1 if (my $ref = tied %{$ns . '::Lexicon';})
512 0 0 if $lh->{'add_lex_hash_silent_if_already_added'} and exists $ref->{'hashes'} and exists $ref->{'hashes'}{$name}
513 0 0 if ($ref->can('add_lookup_fallback_hash'))
519 0 1 if (eval { do { require Sub::Todo } }) { }
531 0 2 if (@_ == 2)
532 0 0 if $langtag eq '*'
537 0 2 unless $langtag
540 1 1 if ($langtag eq '*') { }
543 0 2 if (my $ref = tied %{$ns . '::Lexicon';})
544 0 0 if ($ref->can('del_lookup_hash'))
551 0 1 if $count
554 0 1 if (eval { do { require Sub::Todo } }) { }
563 1 0 $lh->get_language_tag eq $langtag ? :
566 0 1 if (my $ref = tied %{$ns . '::Lexicon';})
567 0 0 if ($ref->can('del_lookup_hash'))
573 0 1 if (eval { do { require Sub::Todo } }) { }
603 2 2 unless (exists $lh->{'Locale::Maketext::Utils'}{'_base_clase_dir'})
611 1 1 if (exists $INC{$inc_key})
612 1 0 if (-e $INC{$inc_key})
637 1 0 if (opendir my $dh, $main_ns_dir)
638 3 4 m[([^/]+)\.pm$] && $1 ne 'Utils' ? :
654 2 13 substr($root, 0, 2) eq 'i_' ? :
659 11 12 if defined $ret
662 11 4 if defined $ret
668 3 0 unless defined $return
670 1 2 if exists $lh->{'cache'}{'get_asset_file'}{$find}{$return}
674 1 2 if -f sprintf($find, $_[0])
679 1 1 if defined $lh->{'cache'}{'get_asset_file'}{$find}{$return}
685 3 0 unless defined $return
687 1 2 if exists $lh->{'cache'}{'get_asset_dir'}{$find}{$return}
691 1 2 if -d sprintf($find, $_[0])
696 1 1 if defined $lh->{'cache'}{'get_asset_dir'}{$find}{$return}
702 3 1 if (defined $which) { }
717 7 8 if (ref $num eq 'ARRAY')
730 7 8 if ($string =~ /%s\b/) { }
3 5 elsif ($num == 0 and $spec_zero) { }
791 0 13 ref $_ eq 'ARRAY' ? :
800 0 24 ref $_ eq 'ARRAY' ? :
809 0 0 ref $_ eq 'ARRAY' ? :
837 0 0 if (ref $lh)
838 0 0 if exists $lh->{'list_separator'}
839 0 0 if exists $lh->{'oxford_separator'}
840 0 0 if exists $lh->{'list_default_and'}
844 0 0 unless @_
846 0 0 ref $_ eq 'ARRAY' ? :
847 0 0 if (@expanded == 1) { }
0 0 elsif (@expanded == 2) { }
874 0 0 unless ($dt =~ /\A[0-9]+\z/)
879 0 0 if ($current)
880 0 0 unless (ref $dt)
885 0 0 if ($current_type eq 'day') { }
0 0 elsif ($current_type eq 'minute') { }
899 0 0 $dt > time ? :
0 0 ref $dt ? :
906 1 0 $_[1] ? :
0 1 !ref($_[0]) ? :
2 1 $_[0] =~ / \A (\d+ (?: [.] \d+ )? ) (?: [:] (.*) )? \z /msx ? :
6 3 ref $_[0] eq 'HASH' ? :
6 9 !defined($_[0]) || $_[0] eq '' ? :
922 3 12 ref $str eq 'CODE' ? :
923 13 2 if (defined $format)
924 3 10 if ($dt->{'locale'}->can($format))
929 2 13 unless defined $format
995 8 2 if (not defined $max_decimal_place) { }
1013 7 3 if ($absnum < 1024) { }
0 3 elsif ($absnum < 1048576) { }
3 0 elsif ($absnum < 1073741824) { }
0 0 elsif ($absnum < 1099511627776) { }
0 0 elsif ($absnum < 1125899906842624) { }
0 0 elsif ($absnum < 1152921504606846976) { }
0 0 elsif ($absnum < 1.1805916207174113e+21) { }
0 0 elsif ($absnum < 1.2089258196146292e+24) { }
1066 0 0 unless defined $value
1068 0 0 if (defined $is_defined_but_false and not $value) { }
1078 2 4 if ($boolean) { }
1082 1 3 if (not defined $boolean and defined $null)
1091 7 84 unless defined $str
1093 79 5 unless $str =~ /\_(\-?[0-9]+)/
1110 7 24 unless defined $str
1123 5 131 if (defined $string and $string ne '' and $string =~ tr/(//)
1127 147 1 if (my $cr = $lh->can('output_' . $output_function)) { }
1132 0 1 if (eval { do { require Sub::Todo } }) { }
1144 4 6 if $utf8 =~ /xn--/
1149 4 2 if ($utf8 =~ /(?:\@|\xef\xbc\xa0|\xef\xb9\xab)/) { }
1160 1 3 if $@
1165 1 1 if $@
1173 4 4 unless $puny =~ /xn--/
1178 3 1 if ($puny =~ /\@/) { }
1186 0 3 if $@
1190 0 1 if $@
1202 4 35 unless ($chr_num =~ /\A\d+\z/)
1203 0 4 if length $chr_num != 1
1204 4 0 unless $lh->context_is_html
1207 0 0 $chr_num eq '>' ? :
0 0 $chr_num eq '<' ? :
0 0 $chr_num eq q['] ? :
0 0 $chr_num eq '&' ? :
0 0 $chr_num eq '"' ? :
1214 0 35 unless $chr_num =~ /\A\d+\z/
1218 4 31 if ($chr_num > 127)
1221 1 3 unless (defined $has_encode)
1227 4 0 if ($has_encode) { }
1248 18 17 if (not $lh->context_is_html) { }
1253 2 2 $chr_num == 173 ? :
2 4 $chr_num == 62 ? :
2 6 $chr_num == 60 ? :
2 8 $chr_num == 39 || $chr_num == 145 || $chr_num == 146 ? :
5 10 $chr_num == 38 ? :
2 15 $chr_num == 34 || $chr_num == 147 || $chr_num == 148 ? :
1266 0 4 if $lh->context_is_plain
1270 2 2 $lh->context_is_ansi ? :
1281 0 85 if (ref $attr_ar eq 'HASH')
1287 46 39 ref $attr_ar->[-1] eq 'HASH' ? :
1292 8 77 if $ar_len % 2
1297 16 45 if (exists $$strip_hr{$attr_ar->[$idx]})
1303 2 43 if (exists $addin->{$atr})
1312 46 39 if ($general_hr)
1314 4 31 if exists $strip_hr->{$k}
1315 2 29 if (exists $addin->{$k})
1324 6 3 unless (exists $did_addin->{$r})
1335 0 9 unless $lh->context_is_html
1346 0 4 unless $lh->context_is_html
1355 3 7 if (not defined $alt or $alt eq '') { }
1362 1 9 unless $lh->context_is_html
1370 1 6 !$lh->context_is_html ? :
1379 1 9 !$lh->context_is_html ? :
1387 0 5 !$lh->context_is_html ? :
1393 0 5 !$lh->context_is_html ? :
1400 0 5 if $lh->context_is_plain
1401 1 4 $lh->context_is_ansi ? :
1408 2 12 if $lh->context_is_plain
1409 2 10 $lh->context_is_ansi ? :
1416 0 6 if $lh->context_is_plain
1419 1 5 $lh->context_is_ansi ? :
1429 4 31 ref $args[-1] eq 'HASH' ? :
1430 9 26 @args % 2 ? :
1434 16 19 if (not $lh->context_is_html) { }
1435 1 15 if ($url_text)
1441 6 9 if (exists $output_config{'plain'})
1447 2 4 $orig ne $output_config{'plain'} && $output_config{'plain'} =~ /\Q$url\E/ ? :
1451 4 15 if (exists $output_config{'html'})
1456 15 4 unless ($output_config{'html'})
1474 2 17 exists $output_config{'_type'} && $output_config{'_type'} eq 'offsite' ? :
1488 0 3 unless $lh->context_is_html
1489 0 3 $empty ? :
1496 0 2 unless $lh->context_is_ansi
1497 0 2 $empty ? :
1504 0 2 unless $lh->context_is_plain
1505 0 2 $empty ? :
1517 5 20 if (not $context) { }
18 2 elsif (exists $contexts{$context}) { }
1519 0 5 if (Web::Detect::detect_web_fast()) { }
1524 0 5 IO::Interactive::Tiny::is_interactive() ? :
1540 15 6 defined $context && exists $contexts{$context} ? :
4 21 $empty ? :
1562 5 225 unless (exists $lh->{'-t-STDIN'})
1566 32 198 unless defined $lh->{'-t-STDIN'}
1567 50 148 if $lh->{'-t-STDIN'} eq '1'
1568 139 9 if $lh->{'-t-STDIN'} eq '0'