Branch Coverage

blib/lib/File/Temp.pm
Criterion Covered Total %
branch 201 364 55.2


line true false branch
333 0 46 unless scalar @_ >= 1
354 0 46 if (ref $template)
361 0 46 if (scalar(@_) % 2 != 0)
368 46 0 if @_
374 0 34 if ($options{'open'} and $options{'mkdir'})
389 0 46 if (substr($template, $start - 4 + 1, 4) ne 'XXXX')
411 10 36 if ($options{'mkdir'}) { }
421 5 5 if ($#dirs == 0) { }
425 0 5 if ($^O eq 'VMS') { }
427 0 0 if $parent eq ''
448 4 32 unless $directories ne ''
458 0 46 unless (-e $parent)
462 0 46 unless (-d $parent)
471 1 45 if ('File::Temp'->safe_level == 1) { }
1 44 elsif ('File::Temp'->safe_level == 2) { }
473 0 1 unless (_is_safe($parent, \$safeerr))
479 0 1 unless (_is_verysafe($parent, \$safeerr))
487 45 1 unless $has_perms
493 34 12 if ($options{'open'}) { }
10 2 elsif ($options{'mkdir'}) { }
497 0 34 if ($] < 5.006)
508 0 34 if ($^O eq 'VMS' and ($options{'unlink_on_close'} and not $KEEP_ALL)) { }
513 1 33 $options{'unlink_on_close'} && !$KEEP_ALL ? :
516 0 0 if defined $LOCKFLAG and $options{'use_exlock'}
519 34 0 if ($open_success) { }
522 33 1 unless $has_perms
531 0 0 unless ($!{'EEXIST'})
542 10 0 if (mkdir $path, 448) { }
551 0 0 unless ($!{'EEXIST'})
565 2 0 unless -e $path
596 0 0 if ($counter > $MAX_GUESS)
622 0 46 unless scalar @_ == 2
631 46 0 $] >= 5.006 ? :
633 9 37 if ($ignore) { }
676 0 2 unless (scalar @info)
681 0 2 if $^O eq 'VMS'
686 0 2 if ($info[4] > 'File::Temp'->top_system_uid and $info[4] != $>)
691 0 0 if ref $err_ref
701 2 0 if ($info[2] & &Fcntl::S_IWGRP or $info[2] & &Fcntl::S_IWOTH)
704 0 2 unless (-d $path)
705 0 0 if ref $err_ref
710 0 2 unless (-k $path)
711 0 0 if ref $err_ref
736 0 1 if $DEBUG
737 0 1 if $^O eq 'VMS'
746 1 0 if eval { do { &POSIX::_PC_CHOWN_RESTRICTED(); 1 } }
749 1 0 if (defined $chown_restricted)
752 1 0 if POSIX::sysconf($chown_restricted)
762 0 0 unless ('File::Spec'->file_name_is_absolute($path))
784 0 0 if $DEBUG
787 0 0 unless _is_safe($dir, $err_ref)
807 0 5 if (grep(($^O eq $_), ('MSWin32', 'os2', 'VMS', 'dos', 'MacOS', 'haiku'))) { }
828 1 2 if $level == 0
831 0 2 if ($^O eq 'MSWin32' or $^O eq 'os2' or $^O eq 'cygwin' or $^O eq 'dos' or $^O eq 'MacOS' or $^O eq 'mpeix') { }
883 0 13 unless defined $at_exit
884 0 13 if @k
886 13 0 if (not $KEEP_ALL)
889 3 10 exists $files_to_unlink{$$} ? :
897 8 0 if (-f $file->[1])
899 0 8 unless unlink $file->[1]
904 2 11 exists $dirs_to_unlink{$$} ? :
907 4 0 if (-d $dir)
913 4 0 if ($at_exit)
914 2 2 unless defined $cwd
916 1 3 if ($abs eq $cwd)
922 0 0 if $@ and $^W
926 1 12 if (defined $cwd_to_remove)
929 0 1 unless chdir $cwd_to_remove
931 0 1 unless chdir $updir
933 0 0 if $@ and $^W
938 3 10 if exists $files_to_unlink{$$}
940 2 11 if exists $dirs_to_unlink{$$}
952 0 14 unless scalar @_ == 3
957 0 14 if $DEBUG
967 4 10 if ($isdir) { }
969 4 0 if (-d $fname) { }
973 0 4 if $^O eq 'VMS'
975 2 2 unless exists $dirs_to_unlink{$$}
979 0 0 if $^W
984 10 0 if (-f $fname) { }
988 5 5 unless exists $files_to_unlink{$$}
992 0 0 if $^W
1005 16 43 scalar(@_) % 2 == 1 ? :
1013 16 37 $leading_template ? :
6 53 exists $args{'TEMPLATE'} ? :
1082 3 12 exists $args->{'UNLINK'} ? :
1091 0 15 if $DEBUG
1139 0 5 exists $args->{'CLEANUP'} ? :
1211 15 3 if (@_)
1250 10 4 if (exists $FILES_CREATED_BY_OBJECT{$$}{$file})
1255 11 3 if (do { *$self }->{'UNLINK'} and not $KEEP_ALL)
1256 0 11 if $DEBUG
1259 4 7 unless $was_created_by_proc
1268 1 6 unless unlink1($self, $file)
1390 1 30 if (@_ and $_[0] eq 'File::Temp')
1409 11 19 @$maybe_template ? :
1415 0 30 unless ($options{'OPEN'})
1417 0 0 if $^W
1422 0 30 if ($options{'DIR'} and $^O eq 'VMS')
1436 11 19 if (defined $template) { }
1438 8 3 if ($options{'DIR'}) { }
0 3 elsif ($options{'TMPDIR'}) { }
1450 6 13 if ($options{'DIR'}) { }
1475 29 1 wantarray ? :
1488 0 30 unless ($fh, $path) = _gettemp($template, 'open', $options{'OPEN'}, 'mkdir', 0, 'unlink_on_close', $unlink_on_close, 'suffixlen', length $options{'SUFFIX'}, 'ErrStr', \$errstr, 'use_exlock', $options{'EXLOCK'}, 'file_permissions', $options{'PERMS'})
1496 10 20 if $options{'UNLINK'}
1499 29 1 if (wantarray) { }
1501 29 0 if ($options{'OPEN'}) { }
1511 0 1 unless unlink0($fh, $path)
1528 26 0 unless $^O eq 'MSWin32' and ${^TAINT}
1530 0 0 if ($checked)
1531 0 0 $alt_tmpdir ? :
1540 0 0 if (mkdir $testpath, 448)
1552 0 0 if (-e $local_app or mkdir $local_app, 448)
1553 0 0 if (mkdir $testpath, 448)
1640 1 9 if (@_ and $_[0] eq 'File::Temp')
1656 5 4 @$maybe_template ? :
1664 5 4 if (defined $template) { }
1667 3 2 if ($options{'TMPDIR'} or $options{'DIR'})
1672 0 3 if $^O eq 'VMS'
1679 3 0 if ($options{'DIR'}) { }
0 0 elsif ($options{'TMPDIR'}) { }
1694 1 3 if ($options{'DIR'}) { }
1709 0 9 if ($^O eq 'VMS')
1713 0 9 if ($^O eq 'MacOS' and substr($template, -1) eq ':')
1719 0 9 unless (undef, $tempdir) = _gettemp($template, 'open', 0, 'mkdir', 1, 'suffixlen', $suffixlen, 'ErrStr', \$errstr)
1728 4 5 if ($options{'CLEANUP'} and -d $tempdir)
1769 0 3 if scalar @_ != 1
1775 0 3 unless ($fh, $path) = _gettemp($template, 'open', 1, 'mkdir', 0, 'suffixlen', 0, 'ErrStr', \$errstr)
1783 3 0 if (wantarray) { }
1812 0 1 if scalar @_ != 2
1822 0 1 unless ($fh, $path) = _gettemp($template, 'open', 1, 'mkdir', 0, 'suffixlen', length $suffix, 'ErrStr', \$errstr)
1830 1 0 if (wantarray) { }
1859 0 1 if scalar @_ != 1
1864 0 1 if ($^O eq 'VMS')
1868 0 1 if ($^O eq 'MacOS' and substr($template, -1) eq ':')
1873 0 1 unless ($junk, $tmpdir) = _gettemp($template, 'open', 0, 'mkdir', 1, 'suffixlen', $suffixlen, 'ErrStr', \$errstr)
1902 0 2 if scalar @_ != 1
1908 0 2 unless ($junk, $tmpname) = _gettemp($template, 'open', 0, 'mkdir', 0, 'suffixlen', 0, 'ErrStr', \$errstr)
1970 0 3 if $tmpdir eq ''
1976 2 1 if (wantarray) { }
2012 0 1 unless unlink0($fh, $file)
2054 0 0 unless scalar @_ == 2
2130 0 5 unless scalar @_ == 2
2136 0 5 unless cmpstat($fh, $path)
2139 5 0 if (_can_unlink_opened_file())
2142 0 5 if $KEEP_ALL
2146 0 5 if -d $path
2147 0 5 unless unlink $path
2152 0 5 if $DEBUG
2160 5 0 if $fh[3] == 0 or $^O eq 'cygwin'
2196 0 12 unless scalar @_ == 2
2202 0 12 if $DEBUG
2213 1 11 unless @fh
2215 0 0 if ($fh[3] > 1 and $^W)
2216 0 0 if $^W
2222 0 11 unless (@path)
2223 0 0 if $^W
2228 0 11 unless (-f $path)
2238 0 11 if ($^O eq 'MSWin32') { }
0 11 elsif ($^O eq 'os2') { }
0 11 elsif ($^O eq 'VMS') { }
0 11 elsif ($^O eq 'dos') { }
0 11 elsif ($^O eq 'mpeix') { }
2252 0 143 if $DEBUG
2256 0 143 unless ($fh[$_] eq $path[$_])
2257 0 0 if $DEBUG
2290 0 7 unless scalar @_ == 2
2296 1 6 unless cmpstat($fh, $path)
2299 0 6 unless close $fh
2305 0 6 if $KEEP_ALL
2418 3 91 if (@_)
2420 0 3 if ($level != 0 and $level != 1 and $level != 2) { }
2421 0 0 if $^W
2424 0 3 if ($] < 5.006 and $level != 0)
2430 3 0 if _can_do_level($level)
2465 0 5 if (@_)
2467 0 0 unless $newuid =~ /^\d+$/s
2627 0 5 if (@_)
2636 5 0 if ($self->unlink_on_destroy and $$ == $self->{'LAUNCHPID'} and not $File::Temp::KEEP_ALL)
2638 5 0 if (-d $self->{'REALNAME'})
2644 0 0 if $@ and $^W