diff options
Diffstat (limited to 'lib/File/Path.pm')
-rw-r--r-- | lib/File/Path.pm | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/File/Path.pm b/lib/File/Path.pm index 6cb675b683..8a17173b0d 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -73,7 +73,8 @@ than VMS is settled. (defaults to FALSE) =back -It returns the number of files successfully deleted. +It returns the number of files successfully deleted. Symlinks are +treated as ordinary files. =head1 AUTHORS @@ -82,10 +83,13 @@ Charles Bailey <bailey@genetics.upenn.edu> =head1 REVISION -This document was last revised 25-Aug-1995, for perl 5.002 +This module was last revised 14-Feb-1996, for perl 5.002. $VERSION is +1.01. =cut +$VERSION = "1.01"; # That's my hobby-horse, A.K. + require 5.000; use Config; use Carp; @@ -95,7 +99,7 @@ require Exporter; $Is_VMS = $Config{'osname'} eq 'VMS'; -sub mkpath{ +sub mkpath { my($paths, $verbose, $mode) = @_; # $paths -- either a path string or ref to list of paths # $verbose -- optional print "mkdir $path" for each directory created @@ -126,7 +130,7 @@ sub rmtree { foreach $root (@{$roots}) { $root =~ s#/$##; - if (-d $root) { + if (not -l $root and -d _) { opendir(D,$root); ($root = VMS::Filespec::unixify($root)) =~ s#\.dir$## if $Is_VMS; @files = map("$root/$_", grep $_!~/^\.{1,2}$/, readdir(D)); @@ -147,7 +151,7 @@ sub rmtree { next; } print "unlink $root\n" if $verbose; - while (-e $root) { # delete all versions under VMS + while (-e $root || -l $root) { # delete all versions under VMS (unlink($root) && ++$count) or carp "Can't unlink file $root: $!"; } |