Branch Coverage

blib/lib/File/Temp.pm
Criterion Covered Total %
branch 205 364 56.3


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) { }
675 0 4 unless (scalar @info)
680 0 4 if $^O eq "VMS"
685 0 4 if ($info[4] > "File::Temp"->top_system_uid and $info[4] != $>)
690 0 0 if ref $err_ref
700 3 1 if ($info[2] & &Fcntl::S_IWGRP or $info[2] & &Fcntl::S_IWOTH)
703 0 3 unless (-d $path)
704 0 0 if ref $err_ref
709 0 3 unless (-k $path)
710 0 0 if ref $err_ref
735 0 1 if $DEBUG
736 0 1 if $^O eq "VMS"
745 1 0 if eval { do { &POSIX::_PC_CHOWN_RESTRICTED(); 1 } }
748 1 0 if (defined $chown_restricted)
751 0 1 if POSIX::sysconf($chown_restricted)
761 0 1 unless ("File::Spec"->file_name_is_absolute($path))
783 0 3 if $DEBUG
786 0 3 unless _is_safe($dir, $err_ref)
806 0 5 if (grep(($^O eq $_), ('MSWin32', 'os2', 'VMS', 'dos', 'MacOS', 'haiku'))) { }
827 1 2 if $level == 0
830 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') { }
882 0 13 unless defined $at_exit
883 0 13 if @k
885 13 0 if (not $KEEP_ALL)
888 3 10 exists $files_to_unlink{$$} ? :
896 8 0 if (-f $file->[1])
898 0 8 unless unlink $file->[1]
903 2 11 exists $dirs_to_unlink{$$} ? :
906 4 0 if (-d $dir)
912 4 0 if ($at_exit)
913 2 2 unless defined $cwd
915 1 3 if ($abs eq $cwd)
921 0 0 if $@ and $^W
925 1 12 if (defined $cwd_to_remove)
928 0 1 unless chdir $cwd_to_remove
930 0 1 unless chdir $updir
932 0 0 if $@ and $^W
937 3 10 if exists $files_to_unlink{$$}
939 2 11 if exists $dirs_to_unlink{$$}
951 0 14 unless scalar @_ == 3
956 0 14 if $DEBUG
966 4 10 if ($isdir) { }
968 4 0 if (-d $fname) { }
972 0 4 if $^O eq "VMS"
974 2 2 unless exists $dirs_to_unlink{$$}
978 0 0 if $^W
983 10 0 if (-f $fname) { }
987 5 5 unless exists $files_to_unlink{$$}
991 0 0 if $^W
1004 16 43 scalar(@_) % 2 == 1 ? :
1012 16 37 $leading_template ? :
6 53 exists $args{'TEMPLATE'} ? :
1081 3 12 exists $args->{'UNLINK'} ? :
1090 0 15 if $DEBUG
1138 0 5 exists $args->{'CLEANUP'} ? :
1210 15 3 if (@_)
1249 10 4 if (exists $FILES_CREATED_BY_OBJECT{$$}{$file})
1254 11 3 if (do { *$self }->{'UNLINK'} and not $KEEP_ALL)
1255 0 11 if $DEBUG
1258 4 7 unless $was_created_by_proc
1267 1 6 unless unlink1($self, $file)
1389 1 30 if (@_ and $_[0] eq "File::Temp")
1408 11 19 @$maybe_template ? :
1414 0 30 unless ($options{'OPEN'})
1416 0 0 if $^W
1421 0 30 if ($options{'DIR'} and $^O eq "VMS")
1435 11 19 if (defined $template) { }
1437 8 3 if ($options{'DIR'}) { }
0 3 elsif ($options{'TMPDIR'}) { }
1449 6 13 if ($options{'DIR'}) { }
1474 29 1 wantarray ? :
1487 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'})
1495 10 20 if $options{'UNLINK'}
1498 29 1 if (wantarray) { }
1500 29 0 if ($options{'OPEN'}) { }
1510 0 1 unless unlink0($fh, $path)
1527 26 0 unless $^O eq "MSWin32" and ${^TAINT}
1529 0 0 if ($checked)
1530 0 0 $alt_tmpdir ? :
1539 0 0 if (mkdir $testpath, 448)
1551 0 0 if (-e $local_app or mkdir $local_app, 448)
1552 0 0 if (mkdir $testpath, 448)
1639 1 9 if (@_ and $_[0] eq "File::Temp")
1655 5 4 @$maybe_template ? :
1663 5 4 if (defined $template) { }
1666 3 2 if ($options{'TMPDIR'} or $options{'DIR'})
1671 0 3 if $^O eq "VMS"
1678 3 0 if ($options{'DIR'}) { }
0 0 elsif ($options{'TMPDIR'}) { }
1693 1 3 if ($options{'DIR'}) { }
1708 0 9 if ($^O eq "VMS" and $template =~ /([\.\]:>]+)$/)
1712 0 9 if ($^O eq "MacOS" and substr($template, -1) eq ":")
1718 0 9 unless (undef, $tempdir) = _gettemp($template, "open", 0, "mkdir", 1, "suffixlen", $suffixlen, "ErrStr", \$errstr)
1727 4 5 if ($options{'CLEANUP'} and -d $tempdir)
1768 0 3 if scalar @_ != 1
1774 0 3 unless ($fh, $path) = _gettemp($template, "open", 1, "mkdir", 0, "suffixlen", 0, "ErrStr", \$errstr)
1782 3 0 if (wantarray) { }
1811 0 1 if scalar @_ != 2
1821 0 1 unless ($fh, $path) = _gettemp($template, "open", 1, "mkdir", 0, "suffixlen", length $suffix, "ErrStr", \$errstr)
1829 1 0 if (wantarray) { }
1858 0 1 if scalar @_ != 1
1863 0 1 if ($^O eq "VMS")
1867 0 1 if ($^O eq "MacOS" and substr($template, -1) eq ":")
1872 0 1 unless ($junk, $tmpdir) = _gettemp($template, "open", 0, "mkdir", 1, "suffixlen", $suffixlen, "ErrStr", \$errstr)
1901 0 2 if scalar @_ != 1
1907 0 2 unless ($junk, $tmpname) = _gettemp($template, "open", 0, "mkdir", 0, "suffixlen", 0, "ErrStr", \$errstr)
1969 0 3 if $tmpdir eq ""
1975 2 1 if (wantarray) { }
2011 0 1 unless unlink0($fh, $file)
2053 0 0 unless scalar @_ == 2
2129 0 5 unless scalar @_ == 2
2135 0 5 unless cmpstat($fh, $path)
2138 5 0 if (_can_unlink_opened_file())
2141 0 5 if $KEEP_ALL
2145 0 5 if -d $path
2146 0 5 unless unlink $path
2151 0 5 if $DEBUG
2159 5 0 if $fh[3] == 0 or $^O eq "cygwin"
2195 0 12 unless scalar @_ == 2
2201 0 12 if $DEBUG
2212 1 11 unless @fh
2214 0 0 if ($fh[3] > 1 and $^W)
2215 0 0 if $^W
2221 0 11 unless (@path)
2222 0 0 if $^W
2227 0 11 unless (-f $path)
2237 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') { }
2251 0 143 if $DEBUG
2255 0 143 unless ($fh[$_] eq $path[$_])
2256 0 0 if $DEBUG
2289 0 7 unless scalar @_ == 2
2295 1 6 unless cmpstat($fh, $path)
2298 0 6 unless close $fh
2304 0 6 if $KEEP_ALL
2417 3 91 if (@_)
2419 0 3 if ($level != 0 and $level != 1 and $level != 2) { }
2420 0 0 if $^W
2423 0 3 if ($] < "5.006" and $level != 0)
2429 3 0 if _can_do_level($level)
2464 0 7 if (@_)
2466 0 0 unless $newuid =~ /^\d+$/s
2626 0 5 if (@_)
2635 5 0 if ($self->unlink_on_destroy and $$ == $self->{'LAUNCHPID'} and not $File::Temp::KEEP_ALL)
2637 5 0 if (-d $self->{'REALNAME'})
2643 0 0 if $@ and $^W