Subject: | Fails on Windows with message: '""' is not recognized as an internal or external command, operable program or batch file. |
On up-to-date Windows 10, installing GPS::Babel via cpanm fails with multiple messages
'""' is not recognized as an internal or external command,
operable program or batch file.
from the tests. See attached build.log.
Force-installing (cpanm --force GPS::Babel) and then executing
use Modern::Perl;
use GPS::Babel;
use YAML::Any qw(Dump);
my $babel = GPS::Babel->new;
my $data = $babel->read('20120628.gdb');
print Dump($data);
in the directory with the named file yields
'""' is not recognized as an internal or external command,
operable program or batch file.
'C:\Program Files (x86)\GPSBabel\gpsbabel.EXE' failed (256)
DIAGNOSIS:
Line 61 of lib/GPS/Babel.pm in sub GPS::Babel::_with_babel reads:
@args = ( '"' . join( '" "', map { s/"/""/g } @args ) . '"' );
The values that the map call returns end up in @args, but those values are the values returned by the s/// calls which indicate the number of substitutions made, not the substitution results. If @args starts out as ('aa', 'bb', 'cc') then it ends up as ('"" "" ""').
One solution is to change map { s/"/""/g } to map { s/"/""/g; $_ }. Another solution is to change map { s/"/""/g } to map { s/"/""/gr }, but the "r" modifier isn't available for Perl versions before 5.14, so the first solution is more portable. And a third solution is to change the entire line to
map { s/"/""/g } @args;
@args = ( '"' . join( '" "', @args ) . '"' )
That one works because the values returned by the map call are discarded but the effect of the s/// calls on the @args elements remains.
If I apply the first solution then my test script succeeds and produces results that look good.
Subject: | build.log |
Message body not shown because it is not plain text.