Branch Coverage

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


line true false branch
38 2 21 unless (exists $user_params->{'input'})
51 0 19 unless ($input_ref eq 'SCALAR' or $input_ref eq 'GLOB')
56 19 0 if ($input_ref eq 'SCALAR') { }
0 0 elsif ($input_ref eq 'GLOB') { }
57 0 19 unless (print $tmp_fh $$input)
62 1 18 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
69 0 0 unless (print $tmp_fh $line)
75 0 0 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
91 0 8 if exists $user_param->{'input'}
129 1 0 unless ($self->{'_digest'})
151 10 0 if defined $tmp_fh
152 10 0 if defined $tmp_filename
159 1 28 unless (exists $params_ref->{'file'} and defined $params_ref->{'file'})
167 2 26 unless (-d $params_ref->{'_dir'})
171 2 25 if (exists $params_ref->{'tmpdir'}) { }
172 1 1 if (not -d $params_ref->{'tmpdir'} and $params_ref->{'tmpdir'} ne $params_ref->{'_dir'})
178 0 1 if ($dev_ids[0] != $dev_ids[1])
186 0 27 if (exists $params_ref->{'safe_level'})
195 0 26 unless (defined $tmp_fh)
199 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'}) { }
213 3 26 if (exists $params_ref->{'CHECKSUM'} and $params_ref->{'CHECKSUM'}) { }
215 0 3 if ($@)
233 1 22 if (exists $params_ref->{'CHECKSUM'} and not exists $params_ref->{'checksum'})
239 0 23 unless $tmp_fh->flush
241 23 0 unless ($^O =~ /Win32/)
242 0 23 unless $tmp_fh->sync
246 2 21 if (exists $params_ref->{'min_size'})
249 3 19 if (exists $params_ref->{'CHECKSUM'})
253 1 22 if ($@)
264 0 22 unless close $tmp_fh
269 4 18 if (exists $params_ref->{'mode'})
271 0 4 unless defined $mode and $mode =~ /^[0-9]+$/
275 2 2 substr($mode, 0, 1) eq '0' ? :
278 0 4 if ($count != 1)
285 0 22 if (exists $params_ref->{'owner'})
287 0 0 if ($@)
293 1 21 if (exists $params_ref->{'mtime'})
296 0 1 unless defined $params_ref->{'mtime'} and $params_ref->{'mtime'} =~ /^[0-9]+$/
300 0 1 if ($count != 1)
309 1 21 if (exists $params_ref->{'backup'} and -f $params_ref->{'file'})
312 0 1 if not defined $params_ref->{'backup'} or $params_ref->{'backup'} eq ''
316 1 0 if (-f $backup_filename)
318 0 1 if ($count != 1)
326 0 1 unless (link $params_ref->{'file'}, $backup_filename)
333 0 22 unless (rename $tmp_filename, $params_ref->{'file'})
349 2 1 if ($mkpath) { }
351 0 2 unless (-d $directory)
365 0 3 unless seek $tmp_fh, 0, 0
373 0 3 if ($on_disk_checksum ne $checksum)
386 0 2 unless seek $tmp_fh, 0, 2
390 0 2 if ($written == -1) { }
1 1 elsif ($written < $min_size) { }
406 0 0 if not defined $owner or length $owner < 1
416 0 0 if (defined $user_name and $user_name ne '')
417 0 0 if ($user_name =~ /^([0-9]+)$/) { }
420 0 0 unless ($login, $pass, $user_uid, $user_gid) = getpwnam $user_name
427 0 0 if (defined $group_name and $group_name ne '')
428 0 0 if ($group_name =~ /^([0-9]+)$/) { }
431 0 0 unless my($group_name, $pass, $group_gid) = getgrnam $group_name
438 0 0 if ($count != 1)