At 2:02 AM +0200 7/23/04, Richard Levitte - VMS Whacker wrote:
<much snippage>
>+ $path =~ s/\[[^\]\.]+\.-\]/\[\]/g; # [foo.-] ==> []
<much more snippage>
Dredging up Richard's patch from a few months ago (which has since
made it into the current version of File::Spec), I think I may have
found an issue with one of the things it does in canonpath,
specifically in the line quoted above. I don't think we really
want to reduce [foo.-] to [], which later gets eliminated entirely.
Let's look at an example:
Before Richard's patch:
$ perl -"MFile::Spec" -e "print File::Spec->canonpath('d0:[d1.-]foo.dat');"
d0:[]foo.dat
After Richard's patch:
$ perl -"MFile::Spec" -e "print File::Spec->canonpath('d0:[d1.-]foo.dat');"
d0:foo.dat
I don't think either of these is the right thing to do with the
[foo.-] case. Consider what DCL does:
$ set default perl_root:[foo.-]
$ show default
perl_root:[000000]
So it seems to me we want to do the same thing DCL does, which the
following little patch will take care of:
--- lib/File/Spec/VMS.pm;-0 Mon Nov 1 10:03:24 2004
+++ lib/File/Spec/VMS.pm Thu Nov 11 09:15:52 2004
@@ -182,7 +182,7 @@ sub canonpath {
$path =~ s/\.[^\]\.]+\.-\./\./g; # .foo.-. ==> .
$path =~ s/\[[^\]\.]+\.-\./\[/g; # [foo.-. ==> [
$path =~ s/\.[^\]\.]+\.-\]/\]/g; # .foo.-] ==> ]
- $path =~ s/\[[^\]\.]+\.-\]/\[\]/g; # [foo.-] ==> []
+ $path =~ s/\[[^\]\.]+\.-\]/\[000000\]/g;# [foo.-] ==> [000000]
$path =~ s/\[\]//; # [] ==>
return $path;
}
[eop]
After that, with our previous example I get:
$ perl -"MFile::Spec" -e "print File::Spec->canonpath('d0:[d1.-]foo.dat');"
d0:[000000]foo.dat
And none of the other new tests fails, so we just might be ok doing
this, but it's such twisty stuff that I'd appreciate feedback,
confirmation, etc.
--
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser