Branch Coverage

blib/lib/CPAN/Meta/YAML.pm
Criterion Covered Total %
branch 171 202 84.6


line true false branch
34 54 57 if (wantarray) { }
57 1 0 if (wantarray) { }
171 3 12 ref $_[0] ? :
174 1 14 unless my $file = shift()
175 1 13 unless -e $file
177 1 12 unless -f _
179 0 12 unless -r _
184 0 12 unless ($fh)
189 12 0 if (_can_flock())
190 0 12 unless flock $fh, 1
200 2 10 if (my $err = $@)
205 0 10 unless (close $fh)
214 1 339 ref $_[0] ? :
218 1 339 unless (defined $string)
224 1 338 if (utf8::is_utf8($string) and not utf8::valid($string))
238 4 334 unless length $string
245 3 331 if @lines and $lines[0] =~ /^\%YAML[: ][\d\.]+.*\z/
251 278 80 if ($lines[0] =~ /^---\s*(?:(.+)\s*)?\z/)
254 43 235 if (defined $1 and not $1 =~ /^(?:\#.+|\%YAML[: ][\d\.]+)\z/)
262 12 303 if (not @lines or $lines[0] =~ /^(?:---|\.\.\.)/) { }
2 301 elsif (not $in_document and @$self) { }
65 236 elsif ($lines[0] =~ /^\s*\-(?:\s|$|-+$)/) { }
236 0 elsif ($lines[0] =~ /^(\s*)\S/) { }
299 15 325 if (ref $err eq 'SCALAR') { }
0 325 elsif ($err) { }
310 5 227 unless length $string
317 1 86 unless length $string
321 13 61 length $1 > 1 ? :
333 38 888 if $string eq '~'
336 185 703 if ($string =~ /^$re_capture_single_quoted$re_trailing_comment\z/)
341 58 645 if ($string =~ /^$re_capture_double_quoted$re_trailing_comment\z/)
346 2 643 if ($string =~ /^[\'\"!&]/)
349 10 633 if $string =~ /^{}(?:\s+\#.*)?\z/
350 10 623 if $string =~ /^\[\](?:\s+\#.*)?\z/
353 614 9 unless ($string =~ /^[>|]/)
354 8 606 if $string =~ /^(?:-(?:\s|$)|[\@\%\`])/ or $string =~ /:(?:\s|$)/
362 0 9 unless @$lines
367 0 9 if (defined $$indent[-2] and $$indent[-1] <= $$indent[-2])
375 6 17 unless length $1 >= $$indent[-1]
379 2 7 substr($string, 0, 1) eq '>' ? :
380 2 7 substr($string, 1, 1) eq '-' ? :
390 15 270 if ($$lines[0] =~ /^(?:---|\.\.\.)/)
399 24 246 if (length $1 < $$indent[-1]) { }
0 246 elsif (length $1 > $$indent[-1]) { }
405 26 220 if ($$lines[0] =~ /^(\s*\-\s+)[^\'\"]\S*\s*:(?:\s+|$)/) { }
38 182 elsif ($$lines[0] =~ /^\s*\-\s*\z/) { }
178 4 elsif ($$lines[0] =~ /^\s*\-(\s*)(.+?)\s*\z/) { }
4 0 elsif (defined $$indent[-2] and $$indent[-1] == $$indent[-2]) { }
414 2 36 unless (@$lines)
418 4 32 if ($$lines[0] =~ /^(\s*)\-/) { }
32 0 elsif ($$lines[0] =~ /^(\s*)\S/) { }
420 4 0 if ($$indent[-1] == $indent2) { }
472 3 1034 if ($$lines[0] =~ /^(?:---|\.\.\.)/)
481 155 879 if (length $1 < $$indent[-1]) { }
0 879 elsif (length $1 > $$indent[-1]) { }
491 47 832 if ($$lines[0] =~ s/^\s*$re_capture_single_quoted$re_key_value_separator//) { }
29 803 elsif ($$lines[0] =~ s/^\s*$re_capture_double_quoted$re_key_value_separator//) { }
802 1 elsif ($$lines[0] =~ s/^\s*$re_capture_unquoted_key$re_key_value_separator//) { }
0 1 elsif ($$lines[0] =~ /^\s*\?/) { }
514 1 877 if (exists $$hash{$key})
519 705 173 if (length $$lines[0]) { }
527 1 172 unless (@$lines)
531 44 128 if ($$lines[0] =~ /^(\s*)-/) { }
128 0 elsif ($$lines[0] =~ /^(\s*)./) { }
538 6 122 if ($$indent[-1] >= $indent2) { }
565 1 4 unless my $file = shift()
569 4 0 if (_can_flock()) { }
573 0 4 unless ($fh)
580 0 4 unless flock $fh, 2
595 0 4 unless (close $fh)
605 4 265 unless ref $self and @$self
616 7 271 if (not defined $cursor) { }
19 252 elsif (not ref $cursor) { }
33 219 elsif (ref $cursor eq 'ARRAY') { }
219 0 elsif (ref $cursor eq 'HASH') { }
625 1 32 unless (@$cursor)
633 1 218 unless (%$cursor)
644 1 264 if (ref $@ eq 'SCALAR') { }
0 264 elsif ($@) { }
664 24 1081 unless defined $string
665 3 1078 unless length $string
666 90 988 if (&Scalar::Util::looks_like_number($string))
668 56 34 if ($is_key or $has_string_flag) { }
675 98 890 if ($string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/)
684 193 697 if ($string =~ /(?:^[~!\@#%&*|>?:,'"`{}\[\]]|^-+$|\s|:\z)/ or $QUOTE{$string})
694 0 55 if ($$seen{&refaddr($array)}++)
701 94 33 if (not $type) { }
1 32 elsif ($type eq 'ARRAY') { }
32 0 elsif ($type eq 'HASH') { }
706 0 1 if (@$el) { }
715 31 1 if (keys %$el) { }
733 1 309 if ($$seen{&refaddr($hash)}++)
741 452 90 if (not $type) { }
26 64 elsif ($type eq 'ARRAY') { }
64 0 elsif ($type eq 'HASH') { }
746 23 3 if (@$el) { }
755 61 3 if (keys %$el) { }
791 0 0 unless $errstr_warned++
813 13 3 if (defined $HAS_FLOCK) { }
820 3 0 if $HAS_FLOCK
834 12 0 if (eval { do { 'Scalar::Util'->VERSION(1.18) } }) { }