Branch Coverage

lib/Data/Pretty.pm
Criterion Covered Total %
branch 199 232 85.7


line true false branch
67 8 104 if @Data::Pretty::FILTERS
88 5 107 if (%Data::Pretty::require)
93 10 102 if (%Data::Pretty::refcnt)
97 10 17 if ($Data::Pretty::refcnt{$name})
111 150 10 defined $_->[1] ? :
115 13 99 if $paren and not $has_qw
117 13 99 if $paren and not $has_qw
119 14 98 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 37 279 if ($v eq '0' or $v =~ /^-?[1-9]\d{0,9}\z/) { }
266 13 elsif ($v =~ /^"([A-Za-z]{1,3}\d*)"\z/) { }
163 14 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 2 7 if ($ref and @i and $i[0] eq "\$")
240 7 28 if ($i eq '*' or $i eq '$') { }
2 26 elsif ($i =~ s/^\*//) { }
247 24 2 unless $last_was_index++
251 7 34 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 1260 $ref ? :
359 26 1374 if ((my $i = rindex($strval, "=")) >= 0)
363 1400 0 if ((my $i = index($strval, '(0x')) >= 0) { }
370 0 1400 if ($] < "5.008" and $type eq "SCALAR")
371 0 0 if $ref eq "REF"
373 0 1400 if $Data::Pretty::DEBUG
378 11 1389 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 1385 15 unless ($dont_remember)
425 19 1366 if (my $s = $Data::Pretty::seen{$id})
430 0 19 if $Data::Pretty::DEBUG
431 15 4 unless $sname eq $name
434 1 3 if @$idx and $idx->[-1] eq "\$"
440 27 1354 if ($class)
445 2 1379 if (defined $out) { }
1246 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') { }
450 32 1214 if ($ref) { }
452 9 23 if ($class and $class eq 'Regexp') { }
456 9 0 if ($v =~ /^\(\?\^?([msix-]*):([\x00-\xFF]*)\)\z/)
464 4 5 if ($sep_count)
469 3 7 if ($c < $sep_count)
472 3 0 if $sep_count == 0
482 11 12 if $type eq "SCALAR"
491 4 19 $class ? :
495 3 1211 if (not defined $$rval) { }
4 1207 elsif ($$rval =~ /^-?(?:nan|inf)/i) { }
896 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 }) { }
508 1 1213 if ($class and not @$idx)
519 6 34 if ($ref) { }
530 4 2 if ($out =~ /^\\\*Symbol::/)
540 61 41 unless defined $gval
541 29 12 if $k eq "SCALAR" and not defined $$gval
597 1 61 if ($hide_keys)
602 43 7 unless /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
605 43 19 if ($text_keys) { }
615 874 33 if $key =~ /^-?[a-zA-Z_]\w*\z/
616 4 29 if $key =~ /^-?[1-9]\d{0,8}\z/
617 3 26 if $key =~ /^-?\d{1,9}\.\d+\z/
628 26 881 if $need_quotes->{$key}
629 109 798 if length $key > $kstat_max
644 47 860 if ((my $i = index(overload::StrVal($$val), "(0x")) >= 0)
648 15 11 if (defined $this_type and $this_type eq "HASH" and scalar keys %{$$rval{$orig};})
657 1 39 if (length $tmp > $Data::Pretty::LINEWIDTH or $tmp =~ /\n/ or $tied or $need_breakdown)
661 1 61 if $tied
665 0 907 $klen_pad ? :
667 854 53 $nl ? :
668 0 907 if $nl and $klen_pad > length $key
671 39 23 unless $nl
676 1 1 if ($Data::Pretty::CODE_DEPARSE and eval { do { require B::Deparse } }) { }
695 3 8 $ref ? :
702 14 1367 if ($class and $ref)
703 0 14 if ($class eq 'Data::Pretty::Literal') { }
712 1 1380 if ($comment)
714 1 0 unless $comment =~ /\n\z/
730 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\@\"\$]/)
739 63 298 if $v =~ /^[-+]?(?:0|[1-9]\d*)(?:\.\d+)?\z/
742 118 12 if $only_numbers == scalar @$rval or scalar @$rval == 1
753 0 0 ref $str eq 'SCALAR' ? :