Branch Coverage

blib/lib/Catmandu/Util.pm
Criterion Covered Total %
branch 144 190 75.7


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(@_)
465 14 8 unless &Scalar::Util::blessed($obj)
467 8 0 unless $obj->isa("boolean") or $obj->isa("Types::Serialiser::Boolean") or $obj->isa("JSON::XS::Boolean") or $obj->isa("Cpanel::JSON::XS::Boolean")
476 84 795 if Data::Util::is_integer($_[0])
480 63 789 if is_integer($_[0])
484 15 6 if is_integer($_[0])
488 0 0 if is_value($_[0]) and $_[0] =~ /^[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?$/
494 18 963 ref $_[0] ? :
499 13 43 unless is_invocant($obj)
506 22 2 if is_able($obj, @_)
512 1 1 if is_maybe_able($obj, @_)
519 144 41 unless &Scalar::Util::blessed($obj)
521 5 25 unless eval {
528 1 1 if is_instance($obj, @_)
535 1 1 if is_maybe_instance($obj, @_)
604 1 0 length $num ? :
609 1 3 if ($size > 1000000000) { }
1 2 elsif ($size > 1000000) { }
1 1 elsif ($size > 1000) { }
654 0 2 if $@
660 0 962 is_ref($_[0]) ? :
663 0 962 unless (-r $class)
666 0 0 unless $class = $INC{$class}
670 0 962 unless open my $input, "<", $class
694 809 72 if ($ns)
695 809 0 unless ($pkg =~ s/^\+// or $pkg =~ /^$ns/)
700 614 267 if is_invocant($pkg)
702 6 261 unless eval "require $pkg;1;"
715 5 2 if (not defined $format or $format eq 'iso_date_time') { }
1 1 elsif ($format eq 'iso_date_time_millis') { }