Michael G Schwern wrote:
Is it correct that File::Spec::VMS->canonpath('[]') returns ''? This is
an explicit clause in File::Spec::VMS::canonpath().
$path =~ s/\[\]// unless $path eq '[]'; # [] ==>
No other File::Spec variation does this, they all return the equivalent
cwd.
Just tried it.
$ perl -mFile::Spec -e "print File::Spec::VMS->canonpath('[]')"
[]
Look again at the above rule, it already does what you want.
This makes File::Spec->canonpath( File::Spec->curdir ) difficult to use
as now you have to carefully distinguish between false and undefined to
see an error.
Actually that brings up a different issue that was discussed on the
vmsperl list. You see '' is a valid file specification on VMS in VMS
file spec format.
So undef is the only way to indicate an error. And it should be that
way on other platforms for consistency.
Can that clause be removed so it returns '[]'?
See above.
On a related note, unlike all the other File::Spec variants
File::Spec->catdir('', 'some', 'dir') does not produce an absolute
path. It does the opposite and produces a relative one. In fact, I
can't see how to make an absolute path on VMS with catdir().
You can not, you need to use catpath to make an absolute path. I do not
know if that is a bug or a feature.
So lets look on Microsoft Windows:
C:\tools>perl -mFile::Spec -e "print File::Spec->catdir('','foo','bar')"
\foo\bar
It looks to me that this is a bug. Both Microsoft Windows and VMS have
volume name components, so the routines should work similar.
While changing this could be seen as breaking compatibility, the
catdir() behavior is tested in t/Spec.t, these differences in behavior
add to the difficulty of writing portable code for VMS. I'd see making
writing compatible code easier a greater priority than maintaining a
historical incompatibility.
From what I have been doing to get tests to pass on VMS, I have found
that a lot of the if $^O eq 'VMS' code is to work around such
inconsistencies. How much code is really expecting them to exist is
unknown.
I plan to start looking at these more in the future. Right now I am
fighting with getting gnu tar 1.19 to run on VMS so I can figure out why
Module::Build is not able to read a tarball that it creates using
Archive::Tar.
-John
[EMAIL PROTECTED]
Personal Opinion Only