Subject: | File::Spec::Win32->catdir loses double slash from UNC paths |
On Windows, File::Spec->catdir() can no longer reconstruct a UNC path
split up by File::Spec->splitdir(). The leading double slash gets
output as a single slash.
This worked correctly up to 3.25; I know this is broken in 3.27, 3.30,
and 3.31 (this might be broken in 3.26; I have not tested that version).
This sample script shows the problem:
use File::Spec;
my $path = "\\\\server\\share\\dir";
print "\npath |$path|\n";
my @dirs = File::Spec->splitdir($path);
print "dirs |".join("|",@dirs)."|\n";
my $npath = File::Spec->catdir(@dirs);
print "npath |$npath|\n";
print (($path eq $npath) ? "OK paths match\n" : "****ERROR****\n");
With AS1005 (using PathTools 3.25):
C:\> d:\Perl-5.10.0-1005\bin\perl fst
path |\\server\share\dir|
dirs |||server|share|dir|
npath |\\server\share\dir|
OK paths match
But switching in 3.30 (or 3.27 or 3.31):
C:\> d:\Perl-5.10.0-1005\bin\perl -IPathTools-3.30/lib fst
path |\\server\share\dir|
dirs |||server|share|dir|
npath |\server\share\dir|
****ERROR****
Notice $npath has only a single leading \.