diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-26 00:33:53 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-01-26 00:33:53 +0000 |
commit | ff21075de7b11172e0f92badf9668f4bf8e30617 (patch) | |
tree | 95dc617e791ae584f87fe0008070d09cb8415be0 /lib/File | |
parent | dd8f48188875f1fb1984b3860e80a9093ac4cab2 (diff) | |
download | perl-ff21075de7b11172e0f92badf9668f4bf8e30617.tar.gz |
avoid failure if directories already read by rmtree() are
deleted by another process
p4raw-id: //depot/perl@4894
Diffstat (limited to 'lib/File')
-rw-r--r-- | lib/File/Path.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/File/Path.pm b/lib/File/Path.pm index bac48a1981..59b72baa45 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -94,14 +94,12 @@ Charles Bailey <F<bailey@newman.upenn.edu>> use 5.005_64; use Carp; use File::Basename (); -use DirHandle (); use Exporter (); use strict; -our($VERSION, @ISA, @EXPORT); -$VERSION = "1.0402"; -@ISA = qw( Exporter ); -@EXPORT = qw( mkpath rmtree ); +our $VERSION = "1.0403"; +our @ISA = qw( Exporter ); +our @EXPORT = qw( mkpath rmtree ); my $Is_VMS = $^O eq 'VMS'; @@ -171,10 +169,14 @@ sub rmtree { or carp "Can't make directory $root read+writeable: $!" unless $safe; - my $d = DirHandle->new($root) - or carp "Can't read $root: $!"; - @files = $d->read; - $d->close; + if (opendir my $d, $root) { + @files = readdir $d; + closedir $d; + } + else { + carp "Can't read $root: $!"; + @files = (); + } # Deleting large numbers of files from VMS Files-11 filesystems # is faster if done in reverse ASCIIbetical order |