Branch Coverage

lib/Data/Pretty.pm
Criterion Covered Total %
branch 195 234 83.3


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
276 343 16 unless /[^\040-\176]/
284 0 16 if ($Data::Pretty::SHOW_UTF8 and utf8::is_utf8($_)) { }
289 0 0 ord $1 <= 255 ? :
310 14 301 if (length $_[0] > 20)
313 4 10 if (/^(.)\1\1\1/s)
316 4 0 unless (/[^\Q$1\E]/)
323 2 8 if (length $_ < 16384 and /^(.{2,5}?)\1*\z/s)
334 3 5 if (length $_ > 40 and not /\\x\{/ and length $_ > length($_[0]) * 2)
340 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 } })
356 2 77 if ($tied)
357 2 0 if (my $tied_ref = ref $tied) { }
370 139 1356 $ref ? :
379 26 1469 if ((my $i = rindex($strval, "=")) >= 0)
383 1495 0 if ((my $i = index($strval, '(0x')) >= 0) { }
390 0 1495 if ($] < "5.008" and $type eq "SCALAR")
391 0 0 if $ref eq "REF"
393 0 1495 if $Data::Pretty::DEBUG
398 11 1484 if (@Data::Pretty::FILTERS)
400 2 9 if $pclass
404 6 5 if (my $f = &$filter($ctx, $rval))
405 1 5 if (my $v = $f->{'object'})
415 1 5 if (defined(my $c = $f->{'bless'}))
418 1 5 if (my $c = $f->{'comment'})
421 1 5 if (defined(my $c = $f->{'dump'}))
425 2 4 if (my $h = $f->{'hide_keys'})
426 2 0 if (ref $h eq "ARRAY")
429 1 1 if $k eq $_[0]
437 2 9 if defined $out and not @bless
438 3 8 if (@bless)
440 0 3 if @bless
444 1480 15 unless ($dont_remember)
447 8 1472 if ($s = $Data::Pretty::seen{$id} and $type ne "SCALAR")
452 0 8 if $Data::Pretty::DEBUG
453 6 2 unless $sname eq $name
456 1 1 if @$idx and $idx->[-1] eq "\$"
462 27 1460 if ($class)
467 2 1485 if (defined $out) { }
1352 133 elsif ($type eq 'SCALAR' or $type eq 'REF' or $type eq 'REGEXP') { }
41 92 elsif ($type eq 'GLOB') { }
18 74 elsif ($type eq 'ARRAY') { }
61 13 elsif ($type eq 'HASH') { }
2 11 elsif ($type eq 'CODE') { }
11 0 elsif ($type eq 'VSTRING') { }
472 41 1311 if ($ref) { }
474 9 32 if ($class and $class eq 'Regexp') { }
478 9 0 if ($v =~ /^\(\?\^?([msix-]*):([\x00-\xFF]*)\)\z/)
486 4 5 if ($sep_count)
491 3 7 if ($c < $sep_count)
494 3 0 if $sep_count == 0
504 20 12 if $type eq "SCALAR"
513 4 28 $class ? :
517 3 1308 if (not defined $$rval) { }
4 1304 elsif ($$rval =~ /^-?(?:nan|inf)/i) { }
993 311 elsif (do { BEGIN {${^WARNING_BITS} = "\x55\x55\x55\x51\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55\x55"} $$rval + 0 eq $$rval }) { }
530 1 1310 if ($class and not @$idx)
541 6 35 if ($ref) { }
552 4 2 if ($out =~ /^\\\*Symbol::/)
562 63 42 unless defined $gval
563 30 12 if $k eq "SCALAR" and not defined $$gval
619 1 60 if ($hide_keys)
624 42 7 unless /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
627 42 19 if ($text_keys) { }
637 962 31 if $key =~ /^-?[a-zA-Z_]\w*\z/
638 4 27 if $key =~ /^-?[1-9]\d{0,8}\z/
639 3 24 if $key =~ /^-?\d{1,9}\.\d+\z/
650 24 969 if $need_quotes->{$key}
651 106 887 if length $key > $kstat_max
666 46 947 if ((my $i = index(overload::StrVal($$val // ""), "(0x")) >= 0)
670 14 11 if (defined $this_type and $this_type eq "HASH" and ref $rval->{$orig} eq "HASH" and scalar keys %{$$rval{$orig};})
679 1 38 if (length $tmp > $Data::Pretty::LINEWIDTH or $tmp =~ /\n/ or $tied or $need_breakdown)
683 1 60 if $tied
687 0 993 $klen_pad ? :
689 945 48 $nl ? :
690 0 993 if $nl and $klen_pad > length $key
693 38 23 unless $nl
698 1 1 if ($Data::Pretty::CODE_DEPARSE and eval { do { require B::Deparse } }) { }
717 3 8 $ref ? :
725 14 1473 if ($class and $ref)
726 0 14 if ($class eq 'Data::Pretty::Literal') { }
735 1 1486 if ($comment)
737 1 0 unless $comment =~ /\n\z/
753 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\@\"\$]/)
762 63 298 if $v =~ /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
765 118 12 if $only_numbers == scalar @$rval or scalar @$rval == 1
776 0 0 ref $str eq 'SCALAR' ? :