From: Slaven Rezic Date: Sun, 17 Aug 2003 12:52:47 +0000 (+0200) Subject: for File::Temp::tempdir(CLEANUP => 1) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6bfdb09083d89dfe43ccf6d8291df274a50c28e6;p=p5sagit%2Fp5-mst-13.2.git for File::Temp::tempdir(CLEANUP => 1) Message-Id: <200308171052.h7HAqlfo026317@vran.herceg.de> p4raw-id: //depot/perl@20839 --- diff --git a/lib/File/Temp.pm b/lib/File/Temp.pm index 5d8dc7b..4b92033 100644 --- a/lib/File/Temp.pm +++ b/lib/File/Temp.pm @@ -855,7 +855,7 @@ sub _can_do_level { # Dirs foreach my $dir (@dirs_to_unlink) { if (-d $dir) { - rmtree($dir, $DEBUG, 1); + rmtree($dir, $DEBUG, 0); } } diff --git a/lib/File/Temp/t/tempfile.t b/lib/File/Temp/t/tempfile.t index 6e3fa94..c8739bf 100755 --- a/lib/File/Temp/t/tempfile.t +++ b/lib/File/Temp/t/tempfile.t @@ -3,7 +3,7 @@ use strict; use Test; -BEGIN { plan tests => 20} +BEGIN { plan tests => 22} use File::Spec; # Will need to check that all files were unlinked correctly @@ -88,6 +88,16 @@ push(@files, $tempfile); ok( (-f $tempfile )); push(@files, $tempfile); +# Test tempfile +# ..and another with changed permissions (read-only) +($fh, $tempfile) = tempfile( + DIR => $tempdir, + ); +chmod 0444, $tempfile; + +ok( (-f $tempfile )); +push(@files, $tempfile); + print "# TEMPFILE: Created $tempfile\n"; # and another (with template)