Unabel to execute when space in pathname
Brought to you by:
crazyinsomniac
I made a small test-script, test.pl:
print "Running fine...\n";
sleep 5;
I built it:
perl -MPerlBin -e"PerlBin->new(qw[ in/test.pl out/test.exe
)"
I copied it to C:\any folder
(making sure the folder name contained a space-
character
I tried to run it by dubble-klicking in windows explorer:
"IMPOSSIBLE!!!
couldn't open -e.exe : No such file or directory at (eval 1)
line 1.
PerlBin compiled '-e.exe' aborting execution!!"
If copied to c:\temp instead, it works fine.
Looks like it doesn't work when a space-char. is
in the name of any sub-directory.
Logged In: NO
I came up with a fix that seems to work.
You edit the file "genperlbin" in the root of the PerlBin directory you extract the package to. In there you will find a line in the C code:
sprintf(HWXmain, "#line 0 %s\n$PerlBin::skipTo = %s;%s\0", argv[0], PerlBin, ##[HWXmain]## );
Change that to:
sprintf(HWXmain, "#line 0 \"%s\"\n$PerlBin::skipTo = %s;%s\0", argv[0], PerlBin, ##[HWXmain]## );
That is, speech marks around the first %s that gets argv[0] (the path to and filename of the current executing file). Windows generally requires speech marks around filenames/paths with spaces in them.
You could do similar for the arguments passed to "RunPerl()" with:
char FilePath[255];
sprintf(FilePath, "\"%s\"", argv[0]);
ARGV[0] = FilePath;
But it doesn't seem to be necessary.
And they said:
// DO NOT EDIT PAST THIS POINT! DON'T ASK WHY!
Cool program.
Logged In: NO
Oh, sorry.
You will need to delete the binperl.exe file created in the root of the package path, and lib\PerlBin\PerlBin.dat. Whatever object files were created. Then run again:
perl makefile.pl
make (I use nmake)
make test
make install
And it should work. May be simpler just to delete the whole package and unpack it again. Edit the changes to "genperlbin" compile and enjoy.