From: Gurusamy Sarathy Date: Wed, 26 Jan 2000 00:33:53 +0000 (+0000) Subject: avoid failure if directories already read by rmtree() are X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ff21075de7b11172e0f92badf9668f4bf8e30617;p=p5sagit%2Fp5-mst-13.2.git avoid failure if directories already read by rmtree() are deleted by another process p4raw-id: //depot/perl@4894 --- diff --git a/lib/File/Path.pm b/lib/File/Path.pm index bac48a1..59b72ba 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -94,14 +94,12 @@ Charles Bailey > 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