Branch Coverage

blib/lib/YAML/As/Parsed.pm
Criterion Covered Total %
branch 95 202 47.0


line true false branch
28 0 0 if (wantarray) { }
49 0 0 if (wantarray) { }
109 3 11 ref $_[0] ? :
112 1 13 unless my $file = shift()
113 1 12 unless -e $file
115 1 11 unless -f _
117 0 11 unless -r _
122 0 11 unless ($fh)
127 11 0 if (_can_flock())
128 0 11 unless flock $fh, 1
138 2 9 if (my $err = $@)
143 0 9 unless (close $fh)
151 1 18 ref $_[0] ? :
155 1 18 unless (defined $string)
161 1 17 if (utf8::is_utf8($string) and not utf8::valid($string))
175 0 17 unless length $string
182 0 17 if @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/
188 19 0 if ($lines[0] =~ /^---\s*(?:(.+)\s*)?\z/)
191 0 19 if (defined $1 and not $1 =~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/)
199 1 18 if (not @lines or $lines[0] =~ /^(?:---|\.\.\.)/) { }
0 18 elsif (not $in_document and @$self) { }
6 12 elsif ($lines[0] =~ /^\s*\-(?:\s|$|-+$)/) { }
12 0 elsif ($lines[0] =~ /^(\s*)\S/) { }
236 2 17 if (ref $err eq 'SCALAR') { }
0 17 elsif ($err) { }
247 0 0 unless length $string
254 0 4 unless length $string
257 0 0 length $1 > 1 ? :
268 7 44 if $string eq "~"
271 0 44 if ($string =~ /^$re_capture_single_quoted$re_trailing_comment\z/)
276 4 40 if ($string =~ /^$re_capture_double_quoted$re_trailing_comment\z/)
281 0 40 if ($string =~ /^[\'\"!&]/)
284 0 40 if $string =~ /^{}(?:\s+\#.*)?\z/
285 0 40 if $string =~ /^\[\](?:\s+\#.*)?\z/
288 40 0 unless ($string =~ /^[>|]/)
289 0 40 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 2 12 if ($lines->[0] =~ /^(?:---|\.\.\.)/)
333 2 10 if (length $1 < $indent->[-1]) { }
0 10 elsif (length $1 > $indent->[-1]) { }
339 6 4 if ($lines->[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/) { }
0 4 elsif ($lines->[0] =~ /^\s*\-\s*\z/) { }
4 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 55 if ($lines->[0] =~ /^(?:---|\.\.\.)/)
414 4 51 if (length $1 < $indent->[-1]) { }
0 51 elsif (length $1 > $indent->[-1]) { }
424 0 51 if ($lines->[0] =~ s/^\s*$re_capture_single_quoted$re_key_value_separator//) { }
0 51 elsif ($lines->[0] =~ s/^\s*$re_capture_double_quoted$re_key_value_separator//) { }
51 0 elsif ($lines->[0] =~ s/^\s*$re_capture_unquoted_key$re_key_value_separator//) { }
0 0 elsif ($lines->[0] =~ /^\s*\?/) { }
447 0 51 if (exists $hash->{$key})
452 47 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 3 unless my $file = shift()
499 3 0 if (_can_flock()) { }
502 0 3 unless sysopen $fh, $file, $flags
508 0 3 unless flock $fh, 2
523 0 3 unless (close $fh)
532 1 4 unless ref $self and @$self
543 0 4 if (not defined $cursor) { }
0 4 elsif (not ref $cursor) { }
0 4 elsif (ref $cursor eq 'ARRAY') { }
4 0 elsif (ref $cursor eq 'HASH') { }
552 0 0 unless (@$cursor)
560 0 4 unless (%$cursor)
571 0 4 if (ref $@ eq 'SCALAR') { }
0 4 elsif ($@) { }
591 0 12 unless defined $string
592 0 12 unless length $string
593 0 12 if (&Scalar::Util::looks_like_number($string))
595 0 0 if ($is_key or $has_string_flag) { }
602 0 12 if ($string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/)
611 0 12 if ($string =~ /(?:^[~!\@#%&*|>?:,'"`{}\[\]]|^-+$|\s|:\z)/ or $QUOTE{$string})
621 0 0 if ($$seen{&refaddr($array)}++)
628 0 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 4 if ($$seen{&refaddr($hash)}++)
668 7 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 12 2 if (defined $HAS_FLOCK) { }
726 2 0 if $HAS_FLOCK
734 8 0 if (eval { do { 'Scalar::Util'->VERSION(1.18) } }) { }