Branch Coverage

blib/lib/File/AtomicWrite.pm
Criterion Covered Total %
branch 67 122 54.9


line true false branch
35 2 21 unless (exists $user_params->{'input'})
48 0 19 unless ($input_ref eq 'SCALAR' or $input_ref eq 'GLOB')
53 19 0 if ($input_ref eq 'SCALAR') { }
0 0 elsif ($input_ref eq 'GLOB') { }
54 0 19 unless (print $tmp_fh $$input)
59 1 18 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
66 0 0 unless (print $tmp_fh $line)
72 0 0 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
88 0 8 if exists $user_param->{'input'}
126 1 0 unless ($self->{'_digest'})
148 10 0 if defined $tmp_fh
149 10 0 if defined $tmp_filename
156 1 28 unless (exists $params_ref->{'file'} and defined $params_ref->{'file'})
164 2 26 unless (-d $params_ref->{'_dir'})
168 2 25 if (exists $params_ref->{'tmpdir'}) { }
169 1 1 if (not -d $params_ref->{'tmpdir'} and $params_ref->{'tmpdir'} ne $params_ref->{'_dir'})
175 0 1 if ($dev_ids[0] != $dev_ids[1])
183 0 27 if (exists $params_ref->{'safe_level'})
192 0 26 unless (defined $tmp_fh)
196 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'}) { }
210 3 26 if (exists $params_ref->{'CHECKSUM'} and $params_ref->{'CHECKSUM'}) { }
212 0 3 if ($@)
230 1 22 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
236 0 23 unless $tmp_fh->flush
238 23 0 unless ($^O =~ /Win32/)
239 0 23 unless $tmp_fh->sync
243 2 21 if (exists $params_ref->{'min_size'})
246 3 19 if (exists $params_ref->{'CHECKSUM'})
250 1 22 if ($@)
261 0 22 unless close $tmp_fh
266 4 18 if (exists $params_ref->{'mode'})
268 0 4 unless defined $mode and $mode =~ /^[0-9]+$/
272 2 2 substr($mode, 0, 1) eq '0' ? :
275 0 4 if ($count != 1)
282 0 22 if (exists $params_ref->{'owner'})
284 0 0 if ($@)
290 1 21 if (exists $params_ref->{'mtime'})
293 0 1 unless defined $params_ref->{'mtime'} and $params_ref->{'mtime'} =~ /^[0-9]+$/
297 0 1 if ($count != 1)
306 1 21 if (exists $params_ref->{'backup'} and -f $params_ref->{'file'})
309 0 1 if not defined $params_ref->{'backup'} or $params_ref->{'backup'} eq ''
313 1 0 if (-f $backup_filename)
315 0 1 if ($count != 1)
325 0 1 unless (link $params_ref->{'file'}, $backup_filename)
332 0 22 unless (rename $tmp_filename, $params_ref->{'file'})
348 2 1 if ($mkpath) { }
350 0 2 unless (-d $directory)
364 0 3 unless seek $tmp_fh, 0, 0
372 0 3 if ($on_disk_checksum ne $checksum)
385 0 2 unless seek $tmp_fh, 0, 2
389 0 2 if ($written == -1) { }
1 1 elsif ($written < $min_size) { }
405 0 0 if not defined $owner or length $owner < 1
415 0 0 if (defined $user_name and $user_name ne '')
416 0 0 if ($user_name =~ /^([0-9]+)$/) { }
419 0 0 unless ($login, $pass, $user_uid, $user_gid) = getpwnam $user_name
426 0 0 if (defined $group_name and $group_name ne '')
427 0 0 if ($group_name =~ /^([0-9]+)$/) { }
430 0 0 unless my($group_name, $pass, $group_gid) = getgrnam $group_name
437 0 0 if ($count != 1)