Skip to content

Commit

Permalink
Fix rmtree argument to remove write protected files
Browse files Browse the repository at this point in the history
svn path=/trunk/perlmods/; revision=8501
  • Loading branch information
timj committed Feb 21, 2005
1 parent e6cfb33 commit 57683f8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
@@ -1,3 +1,12 @@
2005-02-21 Tim Jenness <tjenness@cpan.org>

* t/tempfile.t: Add test for write proteceted temp file (thanks to
Slaven Rezic)

* Temp.pm (_can_do_level): Change argument to rmtree to make it
attempt to remove write-protected files on cleanup (thanks to
Slaven Rezic)

2003-08-16 Tim Jenness <tjenness@cpan.org>

--- RELEASE V0.14 ---
Expand Down
2 changes: 1 addition & 1 deletion Temp.pm
Expand Up @@ -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);
}
}

Expand Down
12 changes: 11 additions & 1 deletion t/tempfile.t
Expand Up @@ -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
Expand Down Expand Up @@ -85,6 +85,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);

Expand Down

0 comments on commit 57683f8

Please sign in to comment.