Index: Changes =================================================================== RCS file: /Users/ken/src/CVS-repository/modules/PathTools/Changes,v retrieving revision 1.78 diff -u -r1.78 Changes --- Changes 13 Apr 2006 02:48:58 -0000 1.78 +++ Changes 23 Apr 2006 02:17:58 -0000 @@ -2,6 +2,9 @@ 3.18 + - Fixed some problems on VMS in which a directory called "0" would be + treated as a second-class citizen. [Peter (Stig) Edwards] + - Added a couple of regression tests to make sure abs2rel('/foo/bar', '/') works as expected. [Chia-liang Kao] Index: lib/File/Spec/VMS.pm =================================================================== RCS file: /Users/ken/src/CVS-repository/modules/PathTools/lib/File/Spec/VMS.pm,v retrieving revision 1.8 diff -u -r1.8 VMS.pm --- lib/File/Spec/VMS.pm 7 Dec 2005 05:24:20 -0000 1.8 +++ lib/File/Spec/VMS.pm 23 Apr 2006 02:22:58 -0000 @@ -85,9 +85,10 @@ =cut sub catdir { - my ($self,@dirs) = @_; - my $dir = pop @dirs; - @dirs = grep($_,@dirs); + my $self = shift; + my $dir = pop; + my @dirs = grep {defined() && length()} @_; + my $rslt; if (@dirs) { my $path = (@dirs == 1 ? $dirs[0] : $self->catdir(@dirs)); @@ -118,9 +119,10 @@ =cut sub catfile { - my ($self,@files) = @_; - my $file = $self->canonpath(pop @files); - @files = grep($_,@files); + my $self = shift; + my $file = $self->canonpath(pop()); + my @files = grep {defined() && length()} @_; + my $rslt; if (@files) { my $path = (@files == 1 ? $files[0] : $self->catdir(@files)); @@ -131,7 +133,7 @@ } else { $rslt = $self->eliminate_macros($spath); - $rslt = vmsify($rslt.($rslt ? '/' : '').unixify($file)); + $rslt = vmsify($rslt.((defined $rslt) && ($rslt ne '') ? '/' : '').unixify($file)); } } else { $rslt = (defined($file) && length($file)) ? vmsify($file) : ''; } @@ -425,7 +427,7 @@ # patch the ones in ExtUtils::MM_VMS instead. sub eliminate_macros { my($self,$path) = @_; - return '' unless $path; + return '' unless (defined $path) && ($path ne ''); $self = {} unless ref $self; if ($path =~ /\s/) { Index: t/Spec.t =================================================================== RCS file: /Users/ken/src/CVS-repository/modules/PathTools/t/Spec.t,v retrieving revision 1.9 diff -u -r1.9 Spec.t --- t/Spec.t 13 Apr 2006 02:48:58 -0000 1.9 +++ t/Spec.t 23 Apr 2006 01:34:44 -0000 @@ -279,6 +279,15 @@ [ "VMS->catfile('c')", 'c' ], [ "VMS->catfile('[]c')", 'c' ], +[ "VMS->catfile('0','b','c')", '[0.b]c' ], +[ "VMS->catfile('a','0','c')", '[a.0]c' ], +[ "VMS->catfile('a','b','0')", '[a.b]0' ], +[ "VMS->catfile('0','0','c')", '[0.0]c' ], +[ "VMS->catfile('a','0','0')", '[a.0]0' ], +[ "VMS->catfile('0','b','0')", '[0.b]0' ], +[ "VMS->catfile('0','0','0')", '[0.0]0' ], + + [ "VMS->splitpath('file')", ',,file' ], [ "VMS->splitpath('[d1.d2.d3]')", ',[d1.d2.d3],' ], [ "VMS->splitpath('[.d1.d2.d3]')", ',[.d1.d2.d3],' ],