Subject: | the "load" sub loses double slash from UNC paths |
We use UNC paths in our company on Windows for installed perl modules. And in the "load" subroutine of ExtUtils::Depends, it loses the double slash from UNC paths.
At present it gets $instpath with below code,
# effectively $instpath = dirname($INC{$relpath})
@pieces = File::Spec->splitdir ($INC{$relpath});
pop @pieces;
my $instpath = File::Spec->catdir (@pieces);
For UNC paths like //server/share/file (\\\\server\\share\\file) as $INC{$relpath}, it finally becomes \\server\\share\\file at $instpath. (This is the behavior of File::Spec's splitdir and catdir. See https://rt.cpan.org/Ticket/Display.html?id=52624 ) And thus the issue makes ExtUtils::Depends fails to provide the correct INC path for Makefile.
The solution is also provided in that open ticket at https://rt.cpan.org/Ticket/Display.html?id=52624
For ExtUtils::Depends it can be like below.
my ($volume, $directories, $file) = File::Spec->splitpath($INC{$relpath});
@pieces = File::Spec->splitdir ($directories);
my $dirs = File::Spec->catdir (@pieces);
my $instpath = File::Spec->catpath($volume, $dirs);