Welcome to the Monastery | |
PerlMonks |
Test::Harness not working on my machineby John M. Dlugosz (Monsignor) |
on Jan 13, 2003 at 04:29 UTC ( [id://226393]=perlquestion: print w/replies, xml ) | Need Help?? |
John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
My first attempt to use the module:
According to the docs, "Test::Harness uses $^X to determine the perl binary to run the tests with." Meanwhile, it appears to simply concatenate it with the arguments and system() that string (or otherwise split on whitespace itself), because it things that the path up to the first space is the whole interpreter name! Why do Perl tools have such problems with spaces? Haven't spaces (as well as control chars, and really anything except a slash) been legal on UNIX systems since the dawn of time? In my own script, I reciently used $^X to launch another perl script and used the list form of system() with no problems. Perl knew that the first one was the program name, and how to quote or escape the argument strings properly on this platform. So what's Test::Harness' problem? A quick search of the code shows: or, to condense that, it turns into The pipe-out form of open takes a single string, as on a command prompt shell, rather than multiple arguments. Perhaps the new list form of open in Perl 5.8 is to provide exactly this? Anyway, the script has to take charge of knowing how to quote/escape whatever all the contents of the command to run. That is fraught with system-specific details, so there should be something like File::Spec to hide that. Is there (yet)? Second, this program makes no attempt to even try! Not only does it fall flat if the Perl path has spaces in it (on any platform), but the scriptname has the same problem. And it's not just spaces—any special characters used by the shell will mess it up, since they are not escaped. I find it amusing that Test::Harness is not itself tested too see how it likes a standard Windows installation (typically C:\Program Files\... and ...\My Documents\...). A quick edit to Test::Harness.pm involving and it gets past that problem. Not as robust as it could be, though, since it doesn't handle Unicode names. —John
Back to
Seekers of Perl Wisdom
|
|