Branch Coverage

blib/lib/File/Slurp.pm
Criterion Covered Total %
branch 111 124 89.5


line true false branch
66 46 188 ref $_[0] eq 'HASH' ? :
72 16 218 if (ref $file_name)
74 0 16 if (ref $ref_result)
78 2 14 if $ref_result
84 14 220 if (ref $file_name) { }
89 36 184 unless (open $fh, '<:raw', $file_name)
94 13 171 if (my $bm = $opts->{'binmode'})
105 158 40 if (my $size = -f $fh && -s _) { }
106 131 27 if $size < $blk_size
109 0 194 unless (defined($read = read($fh, ${$buf_ref;}, $blk_size, $pos)))
119 4 0 if $opts->{'_is_data'} and $opts->{'_data_tell'}
122 0 165 if ${$buf_ref;} and $is_win32 and not $opts->{'binmode'}
127 50 148 if ($want_array or $opts->{'array_ref'})
130 16 34 if defined $sep and $sep eq ''
133 40 10 length ${$buf_ref;} ? :
134 2 48 if $opts->{'chomp'}
135 28 22 if $opts->{'array_ref'}
138 28 120 if $opts->{'scalar_ref'}
140 108 12 if defined $want_array
155 3 18 unless $handle->isa('GLOB')
18 3 if (eval { do { $handle->isa('IO') unless $handle->isa('GLOB') } })
163 0 18 if $err
174 0 3 if $@ or not overload::Overloaded($handle)
199 0 18 if ($@)
207 4 14 if (B::svref_2object($handle)->IO->IoFLAGS & 16)
232 85 100 ref $_[0] eq 'HASH' ? :
241 5 180 if (ref $file_name)
243 0 5 if (ref $ref_result)
248 1 4 if ($ref_result) { }
264 181 4 unless ($fh)
266 1 180 defined $opts->{'perms'} ? :
269 33 148 if $opts->{'append'}
270 2 179 if $opts->{'no_clobber'}
271 30 151 if ($opts->{'atomic'})
277 17 13 if (not defined $opts->{'perms'} and -e $file_name and -f _)
288 14 167 unless (sysopen $fh, $file_name, $mode, $perms)
294 9 162 if (my $binmode = $opts->{'binmode'})
303 10 161 if (ref $opts->{'buf_ref'} eq 'SCALAR') { }
10 151 elsif (ref $_[0] eq 'SCALAR') { }
10 141 elsif (ref $_[0] eq 'ARRAY') { }
325 30 141 if $opts->{'append'}
327 167 4 unless $no_truncate
330 16 155 if ($opts->{'atomic'} and not rename($file_name, $orig_filename))
350 8 13 if (ref $opts eq 'HASH') { }
377 10 5 ref $_[0] eq 'HASH' ? :
387 1 14 unless defined $prepend_data
388 1 14 if ref $prepend_data eq 'SCALAR'
398 4 11 if ($@)
413 3 8 if ($@)
430 2 10 unless ref $opts eq 'HASH'
455 7 5 if ($@)
470 0 5 if ($@)
485 1 6 unless ref $opts eq 'HASH'
510 7 0 if ($@)
525 0 0 if ($@)
540 2 13 ref $_[0] eq 'HASH' ? :
548 7 8 unless (opendir DIRH, $dir)
557 6 2 unless $opts->{'keep_dot_dot'}
559 2 6 if ($opts->{'prefix'})
564 7 1 if wantarray
593 23 71 unless $func
597 71 0 if $func