diff options
author | Chip Salzenberg <chip@pobox.com> | 1999-04-13 04:06:19 +0000 |
---|---|---|
committer | Todd Rinaldo <toddr@cpanel.net> | 2019-10-19 07:03:08 -0500 |
commit | 0342e7f93797c51c08ca600ea8dd1e5ceb9c67c1 (patch) | |
tree | 94181118b28650a4d6862f941cb92d094cb53f35 | |
parent | c5d3e7a63e6d26a184e93d01f3d5665a254122fc (diff) | |
download | perl-0342e7f93797c51c08ca600ea8dd1e5ceb9c67c1.tar.gz |
Properly diagnose missing roots in rmtree().
p4raw-id: //depot/maint-5.004/perl@3230
-rw-r--r-- | lib/File/Path.pm | 11 |
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#/$##; |