Branch Coverage

blib/lib/File/AtomicWrite.pm
Criterion Covered Total %
branch 74 134 55.2


line true false branch
35 1 22 unless defined $user_params
37 2 21 unless (exists $user_params->{'input'})
50 0 19 unless ($input_ref eq 'SCALAR' or $input_ref eq 'GLOB')
55 19 0 if ($input_ref eq 'SCALAR') { }
0 0 elsif ($input_ref eq 'GLOB') { }
56 0 19 unless (print $tmp_fh $$input)
61 1 18 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
67 0 0 unless (print $tmp_fh $line)
72 0 0 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
84 1 7 unless defined $user_param
87 0 8 if exists $user_param->{'input'}
99 0 0 unless defined $level
105 0 1 unless defined $template
116 0 1 unless defined $csum
119 1 0 unless ($self->{'_digest'})
139 10 0 if defined $tmp_fh
140 10 0 if defined $tmp_filename
145 0 29 unless defined $user_params
148 1 28 unless (exists $params_ref->{'file'} and defined $params_ref->{'file'})
156 2 26 unless (-d $params_ref->{'_dir'})
160 2 25 if (exists $params_ref->{'tmpdir'}) { }
161 1 1 if (not -d $params_ref->{'tmpdir'} and $params_ref->{'tmpdir'} ne $params_ref->{'_dir'})
167 0 1 if ($dev_ids[0] != $dev_ids[1])
175 0 27 if (exists $params_ref->{'safe_level'})
184 0 26 unless (defined $tmp_fh)
188 0 26 if (exists $params_ref->{'binmode_layer'} and defined $params_ref->{'binmode_layer'}) { }
1 25 elsif (exists $params_ref->{'BINMODE'} and $params_ref->{'BINMODE'}) { }
202 3 26 if (exists $params_ref->{'CHECKSUM'} and $params_ref->{'CHECKSUM'}) { }
204 0 3 if ($@)
219 1 22 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
225 0 23 unless $tmp_fh->flush
227 23 0 unless ($^O =~ /Win32/)
228 0 23 unless $tmp_fh->sync
232 2 21 if (exists $params_ref->{'min_size'})
235 3 19 if (exists $params_ref->{'CHECKSUM'})
239 1 22 if ($@)
250 0 22 unless close $tmp_fh
255 4 18 if (exists $params_ref->{'mode'})
257 0 4 unless defined $mode and $mode =~ /^[0-9]+$/
261 2 2 substr($mode, 0, 1) eq '0' ? :
264 0 4 if ($count != 1)
271 0 22 if (exists $params_ref->{'owner'})
273 0 0 if ($@)
279 1 21 if (exists $params_ref->{'mtime'})
282 0 1 unless defined $params_ref->{'mtime'} and $params_ref->{'mtime'} =~ /^[0-9]+$/
286 0 1 if ($count != 1)
295 1 21 if (exists $params_ref->{'backup'} and -f $params_ref->{'file'})
298 0 1 if not defined $params_ref->{'backup'} or $params_ref->{'backup'} eq ''
302 1 0 if (-f $backup_filename)
304 0 1 if ($count != 1)
314 0 1 unless (link $params_ref->{'file'}, $backup_filename)
321 0 22 unless (rename $tmp_filename, $params_ref->{'file'})
336 2 1 if ($mkpath) { }
338 0 2 unless -d $directory
349 0 3 unless seek $tmp_fh, 0, 0
357 0 3 if ($on_disk_checksum ne $checksum)
369 0 2 unless seek $tmp_fh, 0, 2
373 0 2 if ($written == -1) { }
1 1 elsif ($written < $min_size) { }
388 0 0 if not defined $owner or length $owner < 1
398 0 0 if (defined $user_name and $user_name ne '')
399 0 0 if ($user_name =~ /^([0-9]+)$/) { }
402 0 0 unless ($login, $pass, $user_uid, $user_gid) = getpwnam $user_name
409 0 0 if (defined $group_name and $group_name ne '')
410 0 0 if ($group_name =~ /^([0-9]+)$/) { }
413 0 0 unless my($group_name, $pass, $group_gid) = getgrnam $group_name
420 0 0 if ($count != 1)