Branch Coverage

blib/lib/File/Temp.pm
Criterion Covered Total %
branch 197 360 54.7


line true false branch
332 0 45 unless scalar @_ >= 1
352 0 45 if (ref $template)
359 0 45 if (scalar(@_) % 2 != 0)
366 45 0 if @_
372 0 33 if ($options{'open'} and $options{'mkdir'})
387 0 45 if (substr($template, $start - 4 + 1, 4) ne 'XXXX')
409 10 35 if ($options{'mkdir'}) { }
419 5 5 if ($#dirs == 0) { }
423 0 5 if ($^O eq 'VMS') { }
425 0 0 if $parent eq ''
446 4 31 unless $directories ne ''
456 0 45 unless (-e $parent)
460 0 45 unless (-d $parent)
469 1 44 if ('File::Temp'->safe_level == 1) { }
1 43 elsif ('File::Temp'->safe_level == 2) { }
471 0 1 unless (_is_safe($parent, \$safeerr))
477 0 1 unless (_is_verysafe($parent, \$safeerr))
488 33 12 if ($options{'open'}) { }
10 2 elsif ($options{'mkdir'}) { }
492 0 33 if ($] < 5.006)
503 0 33 if ($^O eq 'VMS' and ($options{'unlink_on_close'} and not $KEEP_ALL)) { }
508 1 32 $options{'unlink_on_close'} && !$KEEP_ALL ? :
511 0 0 if defined $LOCKFLAG and $options{'use_exlock'}
514 33 0 if ($open_success) { }
526 0 0 unless ($!{'EEXIST'})
537 10 0 if (mkdir $path, 448) { }
546 0 0 unless ($!{'EEXIST'})
560 2 0 unless -e $path
591 0 0 if ($counter > $MAX_GUESS)
617 0 45 unless scalar @_ == 2
626 45 0 $] >= 5.006 ? :
628 9 36 if ($ignore) { }
671 0 2 unless (scalar @info)
676 0 2 if $^O eq 'VMS'
681 0 2 if ($info[4] > 'File::Temp'->top_system_uid and $info[4] != $>)
686 0 0 if ref $err_ref
696 2 0 if ($info[2] & &Fcntl::S_IWGRP or $info[2] & &Fcntl::S_IWOTH)
699 0 2 unless (-d $path)
700 0 0 if ref $err_ref
705 0 2 unless (-k $path)
706 0 0 if ref $err_ref
731 0 1 if $DEBUG
732 0 1 if $^O eq 'VMS'
741 1 0 if eval { do { &POSIX::_PC_CHOWN_RESTRICTED(); 1 } }
744 1 0 if (defined $chown_restricted)
747 1 0 if POSIX::sysconf($chown_restricted)
757 0 0 unless ('File::Spec'->file_name_is_absolute($path))
779 0 0 if $DEBUG
782 0 0 unless _is_safe($dir, $err_ref)
802 0 5 if (grep {$^O eq $_;} 'MSWin32', 'os2', 'VMS', 'dos', 'MacOS', 'haiku') { }
823 1 2 if $level == 0
826 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') { }
878 0 13 unless defined $at_exit
879 0 13 if @k
881 13 0 if (not $KEEP_ALL)
884 3 10 exists $files_to_unlink{$$} ? :
892 8 0 if (-f $file->[1])
894 0 8 unless unlink $file->[1]
899 2 11 exists $dirs_to_unlink{$$} ? :
902 4 0 if (-d $dir)
908 4 0 if ($at_exit)
909 2 2 unless defined $cwd
911 1 3 if ($abs eq $cwd)
917 0 0 if $@ and $^W
921 1 12 if (defined $cwd_to_remove)
924 0 1 unless chdir $cwd_to_remove
926 0 1 unless chdir $updir
928 0 0 if $@ and $^W
933 3 10 if exists $files_to_unlink{$$}
935 2 11 if exists $dirs_to_unlink{$$}
947 0 14 unless scalar @_ == 3
952 0 14 if $DEBUG
962 4 10 if ($isdir) { }
964 4 0 if (-d $fname) { }
968 0 4 if $^O eq 'VMS'
970 2 2 unless exists $dirs_to_unlink{$$}
974 0 0 if $^W
979 10 0 if (-f $fname) { }
983 5 5 unless exists $files_to_unlink{$$}
987 0 0 if $^W
1000 16 42 scalar(@_) % 2 == 1 ? :
1008 16 36 $leading_template ? :
6 52 exists $args{'TEMPLATE'} ? :
1076 3 12 exists $args->{'UNLINK'} ? :
1085 0 15 if $DEBUG
1133 0 5 exists $args->{'CLEANUP'} ? :
1205 15 3 if (@_)
1244 10 4 if (exists $FILES_CREATED_BY_OBJECT{$$}{$file})
1249 11 3 if (do { *$self }->{'UNLINK'} and not $KEEP_ALL)
1250 0 11 if $DEBUG
1253 4 7 unless $was_created_by_proc
1262 1 6 unless unlink1($self, $file)
1377 1 29 if (@_ and $_[0] eq 'File::Temp')
1395 11 18 @$maybe_template ? :
1401 0 29 unless ($options{'OPEN'})
1403 0 0 if $^W
1408 0 29 if ($options{'DIR'} and $^O eq 'VMS')
1422 11 18 if (defined $template) { }
1424 8 3 if ($options{'DIR'}) { }
0 3 elsif ($options{'TMPDIR'}) { }
1436 5 13 if ($options{'DIR'}) { }
1461 28 1 wantarray ? :
1473 0 29 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'})
1481 10 19 if $options{'UNLINK'}
1484 28 1 if (wantarray) { }
1486 28 0 if ($options{'OPEN'}) { }
1496 0 1 unless unlink0($fh, $path)
1513 26 0 unless $^O eq 'MSWin32' and ${^TAINT}
1515 0 0 if ($checked)
1516 0 0 $alt_tmpdir ? :
1525 0 0 if (mkdir $testpath, 448)
1537 0 0 if (-e $local_app or mkdir $local_app, 448)
1538 0 0 if (mkdir $testpath, 448)
1625 1 9 if (@_ and $_[0] eq 'File::Temp')
1641 5 4 @$maybe_template ? :
1649 5 4 if (defined $template) { }
1652 3 2 if ($options{'TMPDIR'} or $options{'DIR'})
1657 0 3 if $^O eq 'VMS'
1664 3 0 if ($options{'DIR'}) { }
0 0 elsif ($options{'TMPDIR'}) { }
1679 1 3 if ($options{'DIR'}) { }
1694 0 9 if ($^O eq 'VMS')
1698 0 9 if ($^O eq 'MacOS' and substr($template, -1) eq ':')
1704 0 9 unless (undef, $tempdir) = _gettemp($template, 'open', 0, 'mkdir', 1, 'suffixlen', $suffixlen, 'ErrStr', \$errstr)
1713 4 5 if ($options{'CLEANUP'} and -d $tempdir)
1754 0 3 if scalar @_ != 1
1760 0 3 unless ($fh, $path) = _gettemp($template, 'open', 1, 'mkdir', 0, 'suffixlen', 0, 'ErrStr', \$errstr)
1768 3 0 if (wantarray) { }
1797 0 1 if scalar @_ != 2
1807 0 1 unless ($fh, $path) = _gettemp($template, 'open', 1, 'mkdir', 0, 'suffixlen', length $suffix, 'ErrStr', \$errstr)
1815 1 0 if (wantarray) { }
1844 0 1 if scalar @_ != 1
1849 0 1 if ($^O eq 'VMS')
1853 0 1 if ($^O eq 'MacOS' and substr($template, -1) eq ':')
1858 0 1 unless ($junk, $tmpdir) = _gettemp($template, 'open', 0, 'mkdir', 1, 'suffixlen', $suffixlen, 'ErrStr', \$errstr)
1887 0 2 if scalar @_ != 1
1893 0 2 unless ($junk, $tmpname) = _gettemp($template, 'open', 0, 'mkdir', 0, 'suffixlen', 0, 'ErrStr', \$errstr)
1955 0 3 if $tmpdir eq ''
1961 2 1 if (wantarray) { }
1997 0 1 unless unlink0($fh, $file)
2039 0 0 unless scalar @_ == 2
2115 0 5 unless scalar @_ == 2
2121 0 5 unless cmpstat($fh, $path)
2124 5 0 if (_can_unlink_opened_file())
2127 0 5 if $KEEP_ALL
2131 0 5 if -d $path
2132 0 5 unless unlink $path
2137 0 5 if $DEBUG
2145 5 0 if $fh[3] == 0 or $^O eq 'cygwin'
2181 0 12 unless scalar @_ == 2
2187 0 12 if $DEBUG
2198 1 11 unless @fh
2200 0 0 if ($fh[3] > 1 and $^W)
2201 0 0 if $^W
2207 0 11 unless (@path)
2208 0 0 if $^W
2213 0 11 unless (-f $path)
2223 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') { }
2237 0 143 if $DEBUG
2241 0 143 unless ($fh[$_] eq $path[$_])
2242 0 0 if $DEBUG
2275 0 7 unless scalar @_ == 2
2281 1 6 unless cmpstat($fh, $path)
2284 0 6 unless close $fh
2290 0 6 if $KEEP_ALL
2403 3 89 if (@_)
2405 0 3 if ($level != 0 and $level != 1 and $level != 2) { }
2406 0 0 if $^W
2409 0 3 if ($] < 5.006 and $level != 0)
2415 3 0 if _can_do_level($level)
2450 0 5 if (@_)
2452 0 0 unless $newuid =~ /^\d+$/s
2612 0 5 if (@_)
2621 5 0 if ($self->unlink_on_destroy and $$ == $self->{'LAUNCHPID'} and not $File::Temp::KEEP_ALL)
2623 5 0 if (-d $self->{'REALNAME'})
2629 0 0 if $@ and $^W