Branch Coverage

lib/Locale/Maketext/Utils.pm
Criterion Covered Total %
branch 289 444 65.0


line true false branch
23 28 170 if ref $compiled ne 'CODE'
29 188 2 if defined $_
45 4 27 if substr($arg, 0, 2) =~ /i[-_]/
48 6 21 unless $loc
61 21 30 if (exists $singleton_stash{$class}{$args_sig}) { }
75 9 11 unless (exists $$lh{'Locales.pm'}{$tag})
94 29 1 unless $ENV{'maketext_obj_skip_env'}
102 27 33 if (defined ${$ns . '::Encoding';})
103 27 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 61 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 4 unless @_ == 2
347 0 4 unless defined $handle and defined $phrase
349 0 4 unless ($$handle{'use_external_lex_cache'})
367 4 0 if (exists $$h_r{$phrase}) { }
0 0 elsif (not $phrase =~ /^_/s and $$h_r{'_AUTO'}) { }
369 0 4 if (ref $$h_r{$phrase})
393 0 4 unless (defined $value)
405 2 3 unless (@langcodes)
412 1 1 if (ref $$lh{'_lang_pm_search_paths'} eq 'ARRAY')
416 1 1 unless @search
421 13 2 unless -d $lookin
422 2 0 if (opendir my $dh, $lookin)
426 0 2 unless $pm
427 0 2 if $pm eq 'Utils'
440 1 4 wantarray && $Locales::VERSION > 0.06 ? :
441 1 4 wantarray && $Locales::VERSION > 0.09 ? :
447 4 13 if (defined $native)
451 4 13 if (defined $direction)
456 1 4 wantarray ? :
465 3 2 unless $lh->langtag_is_loadable($tag)
473 0 1 if (@_ == 3)
479 1 0 $lh->get_language_tag eq $langtag ? :
482 0 1 if (my $ref = tied %{$ns . '::Lexicon';})
483 0 0 if $$lh{'add_lex_hash_silent_if_already_added'} and exists $$ref{'hashes'} and exists $$ref{'hashes'}{$name}
484 0 0 if ($ref->can('add_lookup_override_hash'))
490 0 1 if (eval { do { require Sub::Todo } }) { }
501 0 1 if (@_ == 3)
507 1 0 $lh->get_language_tag eq $langtag ? :
510 0 1 if (my $ref = tied %{$ns . '::Lexicon';})
511 0 0 if $$lh{'add_lex_hash_silent_if_already_added'} and exists $$ref{'hashes'} and exists $$ref{'hashes'}{$name}
512 0 0 if ($ref->can('add_lookup_fallback_hash'))
518 0 1 if (eval { do { require Sub::Todo } }) { }
530 0 2 if (@_ == 2)
531 0 0 if $langtag eq '*'
536 0 2 unless $langtag
539 1 1 if ($langtag eq '*') { }
542 0 2 if (my $ref = tied %{$ns . '::Lexicon';})
543 0 0 if ($ref->can('del_lookup_hash'))
550 0 1 if $count
553 0 1 if (eval { do { require Sub::Todo } }) { }
562 1 0 $lh->get_language_tag eq $langtag ? :
565 0 1 if (my $ref = tied %{$ns . '::Lexicon';})
566 0 0 if ($ref->can('del_lookup_hash'))
572 0 1 if (eval { do { require Sub::Todo } }) { }
602 2 2 unless (exists $$lh{'Locale::Maketext::Utils'}{'_base_clase_dir'})
610 1 1 if (exists $INC{$inc_key})
611 1 0 if (-e $INC{$inc_key})
636 1 0 if (opendir my $dh, $main_ns_dir)
637 3 4 m[([^/]+)\.pm$] && $1 ne 'Utils' ? :
657 9 11 if defined $ret
660 9 4 if defined $ret
666 3 0 unless defined $return
668 1 2 if exists $$lh{'cache'}{'get_asset_file'}{$find}{$return}
672 1 2 if -f sprintf($find, $_[0])
677 1 1 if defined $$lh{'cache'}{'get_asset_file'}{$find}{$return}
683 3 0 unless defined $return
685 1 2 if exists $$lh{'cache'}{'get_asset_dir'}{$find}{$return}
689 1 2 if -d sprintf($find, $_[0])
694 1 1 if defined $$lh{'cache'}{'get_asset_dir'}{$find}{$return}
700 3 1 if (defined $which) { }
715 7 8 if (ref $num eq 'ARRAY')
728 7 8 if ($string =~ /%s\b/) { }
3 5 elsif ($num == 0 and $spec_zero) { }
789 0 13 ref $_ eq 'ARRAY' ? :
798 0 24 ref $_ eq 'ARRAY' ? :
807 0 0 ref $_ eq 'ARRAY' ? :
835 0 0 if (ref $lh)
836 0 0 if exists $$lh{'list_separator'}
837 0 0 if exists $$lh{'oxford_separator'}
838 0 0 if exists $$lh{'list_default_and'}
842 0 0 unless @_
844 0 0 ref $_ eq 'ARRAY' ? :
845 0 0 if (@expanded == 1) { }
0 0 elsif (@expanded == 2) { }
872 0 0 unless ($dt =~ /\A[0-9]+\z/)
877 0 0 if ($current)
878 0 0 unless (ref $dt)
883 0 0 if ($current_type eq 'day') { }
0 0 elsif ($current_type eq 'minute') { }
897 0 0 $dt > time ? :
0 0 ref $dt ? :
904 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 '' ? :
920 3 12 ref $str eq 'CODE' ? :
921 13 2 if (defined $format)
922 3 10 if ($$dt{'locale'}->can($format))
927 2 13 unless defined $format
993 8 2 if (not defined $max_decimal_place) { }
1011 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) { }
1064 0 0 unless defined $value
1066 0 0 if (defined $is_defined_but_false and not $value) { }
1076 2 4 if ($boolean) { }
1080 1 3 if (not defined $boolean and defined $null)
1089 7 84 unless defined $str
1091 79 5 unless $str =~ /\_(\-?[0-9]+)/
1108 7 24 unless defined $str
1121 5 131 if (defined $string and $string ne '' and $string =~ tr/(//)
1125 147 1 if (my $cr = $lh->can('output_' . $output_function)) { }
1130 0 1 if (eval { do { require Sub::Todo } }) { }
1142 4 6 if $utf8 =~ /xn--/
1147 4 2 if ($utf8 =~ /(?:\@|\xef\xbc\xa0|\xef\xb9\xab)/) { }
1158 1 3 if $@
1163 1 1 if $@
1171 4 4 unless $puny =~ /xn--/
1176 3 1 if ($puny =~ /\@/) { }
1184 0 3 if $@
1188 0 1 if $@
1200 4 35 unless ($chr_num =~ /\A\d+\z/)
1201 0 4 if length $chr_num != 1
1202 4 0 unless $lh->context_is_html
1205 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 '"' ? :
1212 0 35 unless $chr_num =~ /\A\d+\z/
1216 4 31 if ($chr_num > 127)
1219 1 3 unless (defined $has_encode)
1225 4 0 if ($has_encode) { }
1246 18 17 if (not $lh->context_is_html) { }
1251 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 ? :
1264 0 4 if $lh->context_is_plain
1268 2 2 $lh->context_is_ansi ? :
1279 0 85 if (ref $attr_ar eq 'HASH')
1285 46 39 ref $$attr_ar[-1] eq 'HASH' ? :
1290 8 77 if $ar_len % 2
1295 16 45 if (exists $$strip_hr{$$attr_ar[$idx]})
1301 2 43 if (exists $$addin{$atr})
1310 46 39 if ($general_hr)
1312 4 31 if exists $$strip_hr{$k}
1313 2 29 if (exists $$addin{$k})
1322 6 3 unless (exists $$did_addin{$r})
1333 0 9 unless $lh->context_is_html
1344 0 4 unless $lh->context_is_html
1353 3 7 if (not defined $alt or $alt eq '') { }
1360 1 9 unless $lh->context_is_html
1368 1 6 !$lh->context_is_html ? :
1377 1 9 !$lh->context_is_html ? :
1385 0 5 !$lh->context_is_html ? :
1391 0 5 !$lh->context_is_html ? :
1398 0 5 if $lh->context_is_plain
1399 1 4 $lh->context_is_ansi ? :
1406 2 12 if $lh->context_is_plain
1407 2 10 $lh->context_is_ansi ? :
1414 0 6 if $lh->context_is_plain
1417 1 5 $lh->context_is_ansi ? :
1427 4 31 ref $args[-1] eq 'HASH' ? :
1428 9 26 @args % 2 ? :
1432 16 19 if (not $lh->context_is_html) { }
1433 1 15 if ($url_text)
1439 6 9 if (exists $output_config{'plain'})
1445 2 4 $orig ne $output_config{'plain'} && $output_config{'plain'} =~ /\Q$url\E/ ? :
1449 4 15 if (exists $output_config{'html'})
1454 15 4 unless ($output_config{'html'})
1471 2 17 exists $output_config{'_type'} && $output_config{'_type'} eq 'offsite' ? :
1486 0 3 unless $lh->context_is_html
1487 0 3 $empty ? :
1494 0 2 unless $lh->context_is_ansi
1495 0 2 $empty ? :
1502 0 2 unless $lh->context_is_plain
1503 0 2 $empty ? :
1515 5 20 if (not $context) { }
18 2 elsif (exists $contexts{$context}) { }
1517 0 5 if (Web::Detect::detect_web_fast()) { }
1522 0 5 IO::Interactive::Tiny::is_interactive() ? :
1536 15 6 defined $context && exists $contexts{$context} ? :
4 21 $empty ? :
1560 5 225 unless (exists $$lh{'-t-STDIN'})
1564 32 198 unless defined $$lh{'-t-STDIN'}
1565 50 148 if $$lh{'-t-STDIN'} eq '1'
1566 139 9 if $$lh{'-t-STDIN'} eq '0'