summaryrefslogtreecommitdiff
path: root/lib/File/Path.pm
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-28 16:49:33 -0800
committerAndy Dougherty <doughera@lafcol.lafayette.edu>1996-02-28 16:49:33 -0800
commita5f75d667838e8e7bb037880391f5c44476d33b4 (patch)
tree5005e888355c1508bc47da697efe119c1615b123 /lib/File/Path.pm
parent2920c5d2b358b11ace52104b6944bfa0e89256a7 (diff)
downloadperl-a5f75d667838e8e7bb037880391f5c44476d33b4.tar.gz
perl 5.002perl-5.002
[editor's note: changes seem to be mostly module updates, documentation changes and some perl API macro additions]
Diffstat (limited to 'lib/File/Path.pm')
-rw-r--r--lib/File/Path.pm14
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: $!";
}