summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>1999-04-13 04:06:19 +0000
committerchip <chip@pobox.com>1999-04-13 04:06:19 +0000
commitb7b03c9a3681dc9bd21cf13cba3ad1aa92b6dee9 (patch)
tree94181118b28650a4d6862f941cb92d094cb53f35
parent51ad2834b2f3f923df5c34a6c258474270c515e7 (diff)
downloadperl-b7b03c9a3681dc9bd21cf13cba3ad1aa92b6dee9.tar.gz
Properly diagnose missing roots in rmtree().
p4raw-id: //depot/maint-5.004/perl@3230
-rw-r--r--lib/File/Path.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/File/Path.pm b/lib/File/Path.pm
index 225ecab4b6..3a859db779 100644
--- a/lib/File/Path.pm
+++ b/lib/File/Path.pm
@@ -103,7 +103,7 @@ use Exporter ();
use strict;
use vars qw( $VERSION @ISA @EXPORT );
-$VERSION = "1.0401";
+$VERSION = "1.0402";
@ISA = qw( Exporter );
@EXPORT = qw( mkpath rmtree );
@@ -148,10 +148,17 @@ sub rmtree {
my($roots, $verbose, $safe) = @_;
my(@files);
my($count) = 0;
- $roots = [$roots] unless ref $roots;
$verbose ||= 0;
$safe ||= 0;
+ if ( defined($roots) && length($roots) ) {
+ $roots = [$roots] unless ref $roots;
+ }
+ else {
+ carp "No root path(s) specified\n";
+ return 0;
+ }
+
my($root);
foreach $root (@{$roots}) {
$root =~ s#/$##;