Subject: | [PATCH] make File::Spec::VMS::splitdir stop returning empty first directory on relative path |
splitdir has been returning an empty first directory when passed a relative path for quite some
time. This causes trouble sometimes and it doesn't look like any other platform does it that
way. catdir() doesn't care for round-trip scenarios. The attached has been checked in to blead
as change #31431.
Subject: | fp.patch.txt |
--- lib/File/Spec/VMS.pm;-0 Tue Jun 13 14:29:14 2006
+++ lib/File/Spec/VMS.pm Wed Jun 20 22:03:49 2007
@@ -4,7 +4,7 @@ use strict;
use vars qw(@ISA $VERSION);
require File::Spec::Unix;
-$VERSION = '1.4';
+$VERSION = '1.4_01';
@ISA = qw(File::Spec::Unix);
@@ -274,7 +274,8 @@ sub splitdir {
# .--] ==> .-.-]
# [--] ==> [-.-]
$dirspec = "[$dirspec]" unless $dirspec =~ /[\[<]/; # make legal
- my(@dirs) = split('\.', vmspath($dirspec));
+ $dirspec =~ s/^(\[|<)\./$1/;
+ my(@dirs) = split /(?<!\^)\./, vmspath($dirspec);
$dirs[0] =~ s/^[\[<]//s; $dirs[-1] =~ s/[\]>]\Z(?!\n)//s;
@dirs;
}
--- lib/File/Spec/t/Spec.t;-0 Thu Oct 12 10:10:26 2006
+++ lib/File/Spec/t/Spec.t Tue Jun 19 21:58:20 2007
@@ -358,16 +358,17 @@ if ($^O eq 'MacOS') {
[ "VMS->splitdir('[]')", '' ],
[ "VMS->splitdir('d1.d2.d3')", 'd1,d2,d3' ],
[ "VMS->splitdir('[d1.d2.d3]')", 'd1,d2,d3' ],
-[ "VMS->splitdir('.d1.d2.d3')", ',d1,d2,d3' ],
-[ "VMS->splitdir('[.d1.d2.d3]')", ',d1,d2,d3' ],
-[ "VMS->splitdir('.-.d2.d3')", ',-,d2,d3' ],
-[ "VMS->splitdir('[.-.d2.d3]')", ',-,d2,d3' ],
+[ "VMS->splitdir('.d1.d2.d3')", 'd1,d2,d3' ],
+[ "VMS->splitdir('[.d1.d2.d3]')", 'd1,d2,d3' ],
+[ "VMS->splitdir('.-.d2.d3')", '-,d2,d3' ],
+[ "VMS->splitdir('[.-.d2.d3]')", '-,d2,d3' ],
[ "VMS->splitdir('[d1.d2]')", 'd1,d2' ],
[ "VMS->splitdir('[d1-.--d2]')", 'd1-,--d2' ],
[ "VMS->splitdir('[d1---.-.d2]')", 'd1---,-,d2' ],
[ "VMS->splitdir('[d1.---.d2]')", 'd1,-,-,-,d2' ],
[ "VMS->splitdir('[d1---d2]')", 'd1---d2' ],
[ "VMS->splitdir('[d1.][000000.d2]')", 'd1,d2' ],
+[ "VMS->splitdir('[.d1.d2^.d3]')", 'd1,d2^.d3' ],
[ "VMS->catdir('')", '' ],
[ "VMS->catdir('d1','d2','d3')", '[.d1.d2.d3]' ],