J
Jim Keenan
I wish to supply a user with a Perl distribution which includes a
command-line utility and whose test suite tests the output of that
utility. The test suite's call to that utility looks like this:
ok(! system("$^X -I$cwd/blib/lib $cwd/blib/script/utility"),
"able to call command-line utility");
where $^X is the name used to execute the current copy of Perl and $cwd
holds the name of the directory from which the test suite is called,
i.e., the directory holding Makefile.PL.
This works fine on my Unix-style system and fine on Win32 *provided*
that $cwd contains no wordspaces. So if the value of $cwd is
"C:/temp/other", the 'system' call correctly expands $cwd and the test
runs as intended.
However, if the value of $cwd is "C:/Documents and
Settings/localuser/My Documents", then the only part of the path that
get substituted is "C:/Documents". The "and" in "Documents and
Settings" is treated by perl as the program to be run, which causes an
error.
I've looked at the documentation for modules such as Cwd and File::Spec
and I don't see a workaround. So, ...
Can anyone suggest how to get 'system' to correctly interpret a
variable which holds a Win32 path which may contain wordspaces?
Thank you very much.
Jim Keenan
command-line utility and whose test suite tests the output of that
utility. The test suite's call to that utility looks like this:
ok(! system("$^X -I$cwd/blib/lib $cwd/blib/script/utility"),
"able to call command-line utility");
where $^X is the name used to execute the current copy of Perl and $cwd
holds the name of the directory from which the test suite is called,
i.e., the directory holding Makefile.PL.
This works fine on my Unix-style system and fine on Win32 *provided*
that $cwd contains no wordspaces. So if the value of $cwd is
"C:/temp/other", the 'system' call correctly expands $cwd and the test
runs as intended.
However, if the value of $cwd is "C:/Documents and
Settings/localuser/My Documents", then the only part of the path that
get substituted is "C:/Documents". The "and" in "Documents and
Settings" is treated by perl as the program to be run, which causes an
error.
I've looked at the documentation for modules such as Cwd and File::Spec
and I don't see a workaround. So, ...
Can anyone suggest how to get 'system' to correctly interpret a
variable which holds a Win32 path which may contain wordspaces?
Thank you very much.
Jim Keenan