Subject: | Failed to recursively create dir if the first part solves to false |
Date: | Sat, 1 Sep 2012 19:13:43 +0200 |
To: | bug-File-Path-Tiny [...] rt.cpan.org |
From: | Gian Piero Carrubba <gpiero [...] rm-rf.it> |
gpiero@caimano test $ perl -MFile::Path::Tiny -E 'say $File::Path::Tiny::VERSION'
0.3
gpiero@caimano test $ perl -MFile::Path::Tiny -E 'File::Path::Tiny::mk("0/1/1/0/1") or die "$!"'
No such file or directory at -e line 1.
gpiero@caimano test $ perl -MFile::Path::Tiny -E 'File::Path::Tiny::mk("0") or die "$!"'
gpiero@caimano test $ perl -MFile::Path::Tiny -E 'File::Path::Tiny::mk("0/1/1/0/1") or die "$!"'
gpiero@caimano test $ tree 0
0
└── 1
└── 1
└── 0
└── 1
4 directories, 0 files
The following patch should fix it ( but to be honest I'm not sure why that
check is there ).
--- Tiny.pm.ori 2012-04-04 22:33:56.000000000 +0200
+++ Tiny.pm 2012-09-01 19:01:01.321314554 +0200
@@ -10,7 +10,7 @@
$mask = oct($mask) if substr( $mask, 0, 1 ) eq '0';
require File::Spec;
my ( $progressive, @parts ) = File::Spec->splitdir($path);
- if ( !$progressive ) {
+ if ( !defined $progressive or $progressive eq '' ) {
$progressive = File::Spec->catdir( $progressive, shift(@parts) );
}
if ( !-d $progressive ) {
Ciao,
Gian Piero.