I have a Perl/POE/Tk script running on Win32 ActivePerl that calls executables using system. I created an exe of the script using pp. I can unpack the exe and see the executables off the root of the “zip” file directory, but when I run the exe and try to use the functionality of the system calls I get a “file not found” type of error;
'..\cpau' is not recognized as an internal or external command,
operable program or batch file.
cpau.exe is one of the included files.
pp is called thus:
pp -i alias3.ico -g -a add_event.job -a add_rec.job -a CPAU.exe -a del_event.job -a del_rec.job -a dnscmd.exe -a eventcreate.exe -o alias_v_3-0.exe alias_poe_V-3_0_par.pl
I am guessing that I need to adjust the path of the system calls. I currently am trying to use the default path;
system("cpau -dec -file add_rec.job -nowarn -wait");
I tried this:
system("..\cpau -dec -file ..\add_rec.job -nowarn -wait");
reasoning that pp put the script in the \scripts\ directory, but no joy. Any suggestions?
Update: My suggestions below do not work. However, I am going to leave them up in case someone else has a similar question. This answer shows a lot of things that may sound reasonable but do not work.
See the discussion following the OP’s repost for code using $ENV{PAR_TEMP} that solves the OP’s problem
FOR REFERENCE
pp docs say:
By using system, you are asking
cmd.exeto find the file and I now realize that probably is a losing battle unless you have a separate executable calledcpau.exe. I do not have time to try this right now, but a you might have to do theforkandexecyourself instead of relying onsystem. As in:Previous answer:
The string you pass to
systemdoes not contain what you think it does:Use (edited following OP’s comment below):
I would also recommend using the list form of
system:In addition, you might find FindBin handy if you want to specify the path to
cpaurelative to the current script’s directory.For example: