Branch Coverage

blib/lib/YAML/As/Parsed.pm
Criterion Covered Total %
branch 111 202 54.9


line true false branch
28 1 0 if (wantarray) { }
49 1 0 if (wantarray) { }
109 3 12 ref $_[0] ? :
112 1 14 unless my $file = shift()
113 1 13 unless -e $file
115 1 12 unless -f _
117 0 12 unless -r _
122 0 12 unless ($fh)
127 12 0 if (_can_flock())
128 0 12 unless flock $fh, 1
138 2 10 if (my $err = $@)
143 0 10 unless (close $fh)
151 1 21 ref $_[0] ? :
155 1 21 unless (defined $string)
161 1 20 if (utf8::is_utf8($string) and not utf8::valid($string))
175 0 20 unless length $string
182 0 20 if @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/
188 25 1 if ($lines[0] =~ /^---\s*(?:(.+)\s*)?\z/)
191 2 23 if (defined $1 and not $1 =~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/)
199 1 23 if (not @lines or $lines[0] =~ /^(?:---|\.\.\.)/) { }
0 23 elsif (not $in_document and @$self) { }
8 15 elsif ($lines[0] =~ /^\s*\-(?:\s|$|-+$)/) { }
15 0 elsif ($lines[0] =~ /^(\s*)\S/) { }
236 3 19 if (ref $err eq 'SCALAR') { }
0 19 elsif ($err) { }
247 0 2 unless length $string
254 0 4 unless length $string
257 0 0 length $1 > 1 ? :
268 7 60 if $string eq "~"
271 2 58 if ($string =~ /^$re_capture_single_quoted$re_trailing_comment\z/)
276 4 54 if ($string =~ /^$re_capture_double_quoted$re_trailing_comment\z/)
281 0 54 if ($string =~ /^[\'\"!&]/)
284 0 54 if $string =~ /^{}(?:\s+\#.*)?\z/
285 0 54 if $string =~ /^\[\](?:\s+\#.*)?\z/
288 54 0 unless ($string =~ /^[>|]/)
289 0 54 if $string =~ /^(?:-(?:\s|$)|[\@\%\`])/ or $string =~ /:(?:\s|$)/
297 0 0 unless @$lines
302 0 0 if (defined $indent->[-2] and $indent->[-1] <= $indent->[-2])
310 0 0 unless length $1 >= $indent->[-1]
314 0 0 substr($string, 0, 1) eq '>' ? :
315 0 0 substr($string, 1, 1) eq '-' ? :
324 4 22 if ($lines->[0] =~ /^(?:---|\.\.\.)/)
333 2 20 if (length $1 < $indent->[-1]) { }
0 20 elsif (length $1 > $indent->[-1]) { }
339 6 14 if ($lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/) { }
0 14 elsif ($lines->[0] =~ /^\s*\-\s*\z/) { }
14 0 elsif ($lines->[0] =~ /^\s*\-(\s*)(.+?)\s*\z/) { }
0 0 elsif (defined $indent->[-2] and $indent->[-1] == $indent->[-2]) { }
348 0 0 unless (@$lines)
352 0 0 if ($lines->[0] =~ /^(\s*)\-/) { }
0 0 elsif ($lines->[0] =~ /^(\s*)\S/) { }
354 0 0 if ($indent->[-1] == $indent2) { }
405 0 60 if ($lines->[0] =~ /^(?:---|\.\.\.)/)
414 4 56 if (length $1 < $indent->[-1]) { }
0 56 elsif (length $1 > $indent->[-1]) { }
424 0 56 if ($lines->[0] =~ s/^\s*$re_capture_single_quoted$re_key_value_separator//) { }
0 56 elsif ($lines->[0] =~ s/^\s*$re_capture_double_quoted$re_key_value_separator//) { }
55 1 elsif ($lines->[0] =~ s/^\s*$re_capture_unquoted_key$re_key_value_separator//) { }
0 1 elsif ($lines->[0] =~ /^\s*\?/) { }
447 0 55 if (exists $hash->{$key})
452 51 4 if (length $lines->[0]) { }
460 0 4 unless (@$lines)
464 2 2 if ($lines->[0] =~ /^(\s*)-/) { }
2 0 elsif ($lines->[0] =~ /^(\s*)./) { }
471 0 2 if ($indent->[-1] >= $indent2) { }
495 1 4 unless my $file = shift()
499 4 0 if (_can_flock()) { }
502 0 4 unless sysopen $fh, $file, $flags
508 0 4 unless flock $fh, 2
523 0 4 unless (close $fh)
532 1 6 unless ref $self and @$self
543 0 10 if (not defined $cursor) { }
2 8 elsif (not ref $cursor) { }
2 6 elsif (ref $cursor eq 'ARRAY') { }
6 0 elsif (ref $cursor eq 'HASH') { }
552 0 2 unless (@$cursor)
560 0 6 unless (%$cursor)
571 0 6 if (ref $@ eq 'SCALAR') { }
0 6 elsif ($@) { }
591 0 32 unless defined $string
592 0 32 unless length $string
593 10 22 if (&Scalar::Util::looks_like_number($string))
595 0 10 if ($is_key or $has_string_flag) { }
602 0 22 if ($string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/)
611 2 20 if ($string =~ /(?:^[~!\@#%&*|>?:,'"`{}\[\]]|^-+$|\s|:\z)/ or $QUOTE{$string})
621 0 2 if ($$seen{&refaddr($array)}++)
628 10 0 if (not $type) { }
0 0 elsif ($type eq 'ARRAY') { }
0 0 elsif ($type eq 'HASH') { }
633 0 0 if (@$el) { }
642 0 0 if (keys %$el) { }
660 0 6 if ($$seen{&refaddr($hash)}++)
668 11 0 if (not $type) { }
0 0 elsif ($type eq 'ARRAY') { }
0 0 elsif ($type eq 'HASH') { }
673 0 0 if (@$el) { }
682 0 0 if (keys %$el) { }
710 0 0 unless $errstr_warned++
719 13 3 if (defined $HAS_FLOCK) { }
726 3 0 if $HAS_FLOCK
734 9 0 if (eval { do { 'Scalar::Util'->VERSION(1.18) } }) { }