On 03 Oct 2007, at 02:53, John E. Malmberg wrote:
Jos I. Boumans wrote:
On 02 Oct 2007, at 14:49, John E. Malmberg wrote:
After encountering this again in the Module Build tests, I think
it may be better to let VMS:::Filespec::vmsify do the
translation, as it knows when to change the dots to underscores.
I like this idea, and it's not hard to implement generically in
C::I::Utils->_safe_path,
where we do pathname fixes for Win32 already.
One question though:
It is a three step procedure:
1. Make sure that the value to be converted, $pkg_namver is in
UNIX directory syntax by appending a '/' to it.
2. Use VMS::Filespec::vmsify($pkg_namver . '/') to convert the
dots to underscores if needed. The trailing '/' is needed as so
that C<vmsify> knows that it should use directory translation
instead of filename translation, as filename translation leaves
one dot.
3. Use
if ($^O eq 'VMS') {
my @dirs =
File::Spec->splitdir(VMS::Filespec::vmsify($pkg_namver . '/')
$pkg_namver = $dirs[0];
}
splitdir() returns an array -- from a generic path, being either /
dir/ or /dir/file, what would
be the right way to get the 'proper' path back? Do we use catfile()?
In this case we know that we called splitdir on a single directory,
so the first and only element of the returned array is the value
that we want, as per the updated sample above.
In this case it's a single directory yes, but i've generalized it to
'fix unsafe paths' on VMS.
What would be the proper way to reconstruct the path after the '/'
trick on VMS?
--
Jos Boumans
How do I prove I'm not crazy to people who are?