=back
It returns a list of all directories (including intermediates, determined
-using the Unix '/' separator) created.
+using the Unix '/' separator) created. In scalar context it returns
+the number of directories created.
If a system error prevents a directory from being created, then the
C<mkpath> function throws a fatal error with C<Carp::croak>. This error
=back
-It returns the number of files successfully deleted. Symlinks are
-simply deleted and not followed.
+It returns the number of files, directories and symlinks successfully
+deleted. Symlinks are simply deleted and not followed.
B<NOTE:> There are race conditions internal to the implementation of
C<rmtree> making it unsafe to use on directory trees which may be
use strict;
use warnings;
-our $VERSION = "1.07_01";
+our $VERSION = "1.08";
our @ISA = qw( Exporter );
our @EXPORT = qw( mkpath rmtree );
if ($Is_VMS) {
next if $path eq '/';
$path = VMS::Filespec::unixify($path);
- if ($path =~ m:^(/[^/]+)/?\z:) {
- $path = $1.'/000000';
- }
}
next if -d $path;
my $parent = File::Basename::dirname($path);
unless (mkdir($path,$mode)) {
my $e = $!;
# allow for another process to have created it meanwhile
- croak ("mkdir $path: $e") unless -d $path;
+ $! = $e, croak ("mkdir $path: $e") unless -d $path;
}
push(@created, $path);
}