develooper Front page | perl.perl5.porters | Postings from May 2008

Re: File::Path::mkpath() incompatiblity in perl-5.10

Thread Previous | Thread Next
Gisle Aas
May 8, 2008 09:21
Re: File::Path::mkpath() incompatiblity in perl-5.10
Message ID:
On May 8, 2008, at 11:02, David Landgren wrote:

> Gisle Aas wrote:
>> I had some production code using File::Path::mkpath() that started  
>> to misbehave after upgrading to perl-5.10.  The bug is  
>> demonstrated with the following script:
>>   #!/usr/bin/perl
>>   use File::Path qw(mkpath);
>>   print "$File::Path::VERSION\n";
>>   mkpath("foo", !shift, 0755);
>>   rmdir("foo");
>> This script will create a directory called "493" in the current  
>> directory if invoked with 1 as argument.  This did not happen with  
>> perl-5.8 and earlier.
> This took a while to replicate because the bug only manifests  
> itself if the working directory is empty. Without looking at the  
> code I can't imagine why that would be. Fix forthcoming.

That's strange as I certainly don't need an empty working directory  
for it to happen here.

I think that the only safe way to approach this is to only assume the  
new style calling convention when the last argument passed is a hash  
reference.  Trying some pattern matching to guess if the second  
argument is a filename or a boolean is doomed to fail.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About