Branch Coverage

blib/lib/Catmandu/Util.pm
Criterion Covered Total %
branch 141 186 75.8


line true false branch
120 71 42 if (is_scalar_ref($arg)) { }
17 25 elsif (is_glob_ref(\$arg) or is_glob_ref($arg)) { }
22 3 elsif (is_string($arg)) { }
1 2 elsif (is_code_ref($arg) and $mode eq 'r') { }
1 1 elsif (is_code_ref($arg) and $mode eq 'w') { }
1 0 elsif (is_instance($arg, 'IO::Handle')) { }
122 71 0 if defined $io
126 17 0 if defined $io
130 22 0 if defined $io
140 1 0 if defined $io
153 0 3 unless open my $fh, "<:encoding(UTF-8)", $path
162 2 1 if $io->can("binmode")
174 0 1 unless open my $fh, ">:encoding(UTF-8)", $path
223 1 0 defined $base_path ? :
235 0 0 unless $filename
244 0 0 if $mime
259 5 2 if (is_array_ref($data))
260 0 1 unless @$data
1 4 if ($key eq '$first') { }
1 3 elsif ($key eq '$last') { }
1 2 elsif ($key eq '*') { }
261 0 1 unless @$data
263 3 1 if (array_exists($data, $key))
268 1 1 if (is_hash_ref($data) and exists $data->{$key})
276 0 15 unless @vals
277 12 3 if (is_array_ref($data))
278 0 2 unless @$data
2 10 if ($key eq '$first') { }
2 8 elsif ($key eq '$last') { }
2 6 elsif ($key eq '$prepend') { }
2 4 elsif ($key eq '$append') { }
1 3 elsif ($key eq '*') { }
279 0 2 unless @$data
286 6 1 if is_natural($key)
289 2 1 if (is_hash_ref($data))
297 5 2 if (is_array_ref($data))
298 0 1 unless @$data
1 4 if ($key eq '$first') { }
1 3 elsif ($key eq '$last') { }
1 2 elsif ($key eq '*') { }
299 0 1 unless @$data
301 3 1 if (array_exists($data, $key))
306 1 0 if (is_hash_ref($data) and exists $data->{$key})
315 0 13 if (ref $path) { }
323 0 0 if (defined $opts{'key'} and $create and @$path)
328 0 18 unless is_ref($data)
329 5 13 if (is_array_ref($data)) { }
0 13 elsif ($create and @$path) { }
330 0 5 if ($key eq '*') { }
336 1 4 if ($key eq '$first') { }
1 3 elsif ($key eq '$last') { }
1 2 elsif ($key eq '$prepend') { }
1 1 elsif ($key eq '$append') { }
340 0 5 unless is_integer($key)
341 0 5 if ($create and @$path) { }
342 0 0 is_integer($path->[0]) || ord $path->[0] == 36 ? :
351 0 0 is_integer($path->[0]) || ord $path->[0] == 36 ? :
357 0 18 if ($create and @$path == 1)
366 10 0 if is_natural($i)
373 3 1 if defined $k
390 1 6 $size > 2 ? :
413 0 1 @$arr < 2 ? :
425 12 8 is_array_ref($arr) ? :
436 648 7 if ($str)
454 1 1 unless is_same(@_)
459 1 1 if is_same(@_)
464 8 14 if &Scalar::Util::blessed($_[0])
473 84 795 if Data::Util::is_integer($_[0])
477 63 789 if is_integer($_[0])
481 15 6 if is_integer($_[0])
485 0 0 if is_value($_[0]) and $_[0] =~ /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/
491 18 963 ref $_[0] ? :
496 13 42 unless is_invocant($obj)
503 21 2 if is_able($obj, @_)
509 1 1 if is_maybe_able($obj, @_)
516 144 62 unless &Scalar::Util::blessed($obj)
523 1 1 if is_instance($obj, @_)
530 1 1 if is_maybe_instance($obj, @_)
599 1 0 length $num ? :
604 1 3 if ($size > 1000000000) { }
1 2 elsif ($size > 1000000) { }
1 1 elsif ($size > 1000) { }
649 0 2 if $@
655 0 962 is_ref($_[0]) ? :
658 0 962 unless (-r $class)
661 0 0 unless $class = $INC{$class}
665 0 962 unless open my $input, "<", $class
689 809 72 if ($ns)
690 809 0 unless ($pkg =~ s/^\+// or $pkg =~ /^$ns/)
695 614 267 if is_invocant($pkg)
697 6 261 unless eval "require $pkg;1;"
710 5 2 if (not defined $format or $format eq 'iso_date_time') { }
1 1 elsif ($format eq 'iso_date_time_millis') { }