Branch Coverage

lib/Data/Pretty.pm
Criterion Covered Total %
branch 196 232 84.4


line true false branch
67 8 104 if @Data::Pretty::FILTERS
88 5 107 if (%Data::Pretty::require)
93 8 104 if (%Data::Pretty::refcnt)
97 8 8 if ($Data::Pretty::refcnt{$name})
111 152 8 defined $_->[1] ? :
115 13 99 if $paren and not $has_qw
117 13 99 if $paren and not $has_qw
119 12 100 if (%Data::Pretty::refcnt or %Data::Pretty::require)
125 0 112 unless defined wantarray
139 32 98 $paren ? :
140 130 0 defined $opts->{'use_qw'} ? :
143 12 118 if (@$values > 3)
152 40 276 if ($v eq '0' or $v =~ /^-?[1-9]\d{0,9}\z/) { }
266 10 elsif ($v =~ /^"([A-Za-z]{1,3}\d*)"\z/) { }
163 17 289 if $values->[$j] ne $v
166 9 31 if ($j - $i > 3)
174 1 129 if ($use_qw)
186 1 129 $use_qw ? :
187 1 129 if ($comment or @$values > $indent_lim and length $tmp > $Data::Pretty::LINEWIDTH || $tmp =~ /\n/) { }
188 0 1 if ($use_qw) { }
194 0 0 if (scalar @buf and length $Data::Pretty::INDENT . join(' ', @buf, $v) > $Data::Pretty::LINEWIDTH) { }
204 0 0 if scalar @buf
206 0 0 scalar @lines > 1 ? :
0 0 scalar @lines > 1 ? :
0 0 $comment ? :
215 1 0 $comment ? :
219 1 128 $use_qw ? :
229 0 0 if ($ref and @i and $i[0] eq "\$")
240 7 22 if ($i eq '*' or $i eq '$') { }
2 20 elsif ($i =~ s/^\*//) { }
247 18 2 unless $last_was_index++
251 0 28 if $ref
272 345 16 unless /[^\040-\176]/
280 5 11 unless ($Data::Pretty::SHOW_UTF8)
290 14 301 if (length $_[0] > 20)
293 4 10 if (/^(.)\1\1\1/s)
296 4 0 unless (/[^\Q$1\E]/)
303 2 8 if (length $_ < 16384 and /^(.{2,5}?)\1*\z/s)
314 3 5 if (length $_ > 40 and not /\\x\{/ and length $_ > length($_[0]) * 2)
320 1 1 if ($Data::Pretty::TRY_BASE64 and length $_[0] > $Data::Pretty::TRY_BASE64 and (defined &utf8::is_utf8 and not utf8::is_utf8($_[0])) and eval { do { require MIME::Base64 } })
336 2 78 if ($tied)
337 2 0 if (my $tied_ref = ref $tied) { }
350 140 1269 $ref ? :
359 26 1383 if ((my $i = rindex($strval, "=")) >= 0)
363 1409 0 if ((my $i = index($strval, '(0x')) >= 0) { }
370 0 1409 if ($] < "5.008" and $type eq "SCALAR")
371 0 0 if $ref eq "REF"
373 0 1409 if $Data::Pretty::DEBUG
378 11 1398 if (@Data::Pretty::FILTERS)
380 2 9 if $pclass
384 6 5 if (my $f = &$filter($ctx, $rval))
385 1 5 if (my $v = $f->{'object'})
395 1 5 if (defined(my $c = $f->{'bless'}))
398 1 5 if (my $c = $f->{'comment'})
401 1 5 if (defined(my $c = $f->{'dump'}))
405 2 4 if (my $h = $f->{'hide_keys'})
406 2 0 if (ref $h eq "ARRAY")
409 1 1 if $k eq $_[0]
417 2 9 if defined $out and not @bless
418 3 8 if (@bless)
420 0 3 if @bless
424 1394 15 unless ($dont_remember)
427 8 1386 if ($s = $Data::Pretty::seen{$id} and $type ne "SCALAR")
432 0 8 if $Data::Pretty::DEBUG
433 6 2 unless $sname eq $name
436 1 1 if @$idx and $idx->[-1] eq "\$"
442 27 1374 if ($class)
447 2 1399 if (defined $out) { }
1266 133 elsif ($type eq 'SCALAR' or $type eq 'REF' or $type eq 'REGEXP') { }
40 93 elsif ($type eq 'GLOB') { }
18 75 elsif ($type eq 'ARRAY') { }
62 13 elsif ($type eq 'HASH') { }
2 11 elsif ($type eq 'CODE') { }
11 0 elsif ($type eq 'VSTRING') { }
452 41 1225 if ($ref) { }
454 9 32 if ($class and $class eq 'Regexp') { }
458 9 0 if ($v =~ /^\(\?\^?([msix-]*):([\x00-\xFF]*)\)\z/)
466 4 5 if ($sep_count)
471 3 7 if ($c < $sep_count)
474 3 0 if $sep_count == 0
484 20 12 if $type eq "SCALAR"
493 4 28 $class ? :
497 3 1222 if (not defined $$rval) { }
4 1218 elsif ($$rval =~ /^-?(?:nan|inf)/i) { }
907 311 elsif (do { BEGIN {${^WARNING_BITS} = "\x54\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x05"} $$rval + 0 eq $$rval }) { }
510 1 1224 if ($class and not @$idx)
521 6 34 if ($ref) { }
532 4 2 if ($out =~ /^\\\*Symbol::/)
542 61 41 unless defined $gval
543 29 12 if $k eq "SCALAR" and not defined $$gval
599 1 61 if ($hide_keys)
604 43 7 unless /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
607 43 19 if ($text_keys) { }
617 874 33 if $key =~ /^-?[a-zA-Z_]\w*\z/
618 4 29 if $key =~ /^-?[1-9]\d{0,8}\z/
619 3 26 if $key =~ /^-?\d{1,9}\.\d+\z/
630 26 881 if $need_quotes->{$key}
631 109 798 if length $key > $kstat_max
646 47 860 if ((my $i = index(overload::StrVal($$val // ""), "(0x")) >= 0)
650 15 11 if (defined $this_type and $this_type eq "HASH" and scalar keys %{$$rval{$orig};})
659 1 39 if (length $tmp > $Data::Pretty::LINEWIDTH or $tmp =~ /\n/ or $tied or $need_breakdown)
663 1 61 if $tied
667 0 907 $klen_pad ? :
669 854 53 $nl ? :
670 0 907 if $nl and $klen_pad > length $key
673 39 23 unless $nl
678 1 1 if ($Data::Pretty::CODE_DEPARSE and eval { do { require B::Deparse } }) { }
697 3 8 $ref ? :
705 14 1387 if ($class and $ref)
706 0 14 if ($class eq 'Data::Pretty::Literal') { }
715 1 1400 if ($comment)
717 1 0 unless $comment =~ /\n\z/
733 13 361 if (not defined $v or ref $v or substr(overload::StrVal(\$v), 0, 7) eq "VSTRING" or not ref $v and $v =~ /[\,\\\#[:blank:]\h\v\a\b\t\n\f\r\e\@\"\$]/)
742 63 298 if $v =~ /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
745 118 12 if $only_numbers == scalar @$rval or scalar @$rval == 1
756 0 0 ref $str eq 'SCALAR' ? :