From: Craig A. Berry Date: Thu, 21 Jun 2007 03:15:59 +0000 (+0000) Subject: Make File::Spec::VMS->splitdir stop returning an empty first directory X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2e74f398c14d9f8160c3fdf711bc51b496d9f5a9;p=p5sagit%2Fp5-mst-13.2.git Make File::Spec::VMS->splitdir stop returning an empty first directory when passed a relative path. Also, don't split on escaped directory delimiters. p4raw-id: //depot/perl@31431 --- diff --git a/lib/File/Spec/VMS.pm b/lib/File/Spec/VMS.pm index f8c488d..0802a03 100644 --- a/lib/File/Spec/VMS.pm +++ b/lib/File/Spec/VMS.pm @@ -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 /(?]\Z(?!\n)//s; @dirs; } diff --git a/lib/File/Spec/t/Spec.t b/lib/File/Spec/t/Spec.t index e1e620d..96d5efa 100644 --- a/lib/File/Spec/t/Spec.t +++ b/lib/File/Spec/t/Spec.t @@ -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]' ],