This tells me that this is a version that should be signalling the the __WARN__ for failures. I see that when a file cannot be unlinked it uses carp to throw a warning:(Snippet from File::Path 1.0401)It returns the number of files successfully deleted. Symlinks are treated as ordinary files. B<NOTE:> If the third parameter is not TRUE, C<rmtree> is B<unsecure> in the face of failure or interruption. Files and directories which were not deleted may be left with permissions reset to allow world read and write access. Note also that the occurrence of errors in rmtree can be determined I<only> by trapping diagnostic messages using C<$SIG{__WARN__}>; it is not apparent from the return value. Therefore, you must be extremely careful about using C<rmtree($foo,$ba +r,0> in situations where security is an issue.
But my code is not catching the __WARN__ signal.unless (unlink $root) { carp "Can't unlink file $root: $!"; if ($force_writeable) { chmod $rp, $root or carp("and can't restore permissions to " . sprintf("0%o",$rp) . "\n"); } last; }
Thanks for continuing to help with this.$SIG{'__WARN__'} = sub { die $_[0] }; rmtree("/tmp/tempdir",0,1); $SIG{'__WARN__'} = 'DEFAULT';
In reply to Re: Re: rmtree __WARN__
by skerr1
in thread rmtree __WARN__
by skerr1
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |