Why don't my system calls work in the Perl program that I wrap pp?

I have a Perl / POE / Tk script running on Win32 ActivePerl that calls executable files using system . I created exe from script using pp . I can unzip exe and see executable files from the root directory โ€œzipโ€, but when I start exe and try to use the functionality of system calls, I get an error like โ€œfile not foundโ€;

 '..\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 like this:

 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 assume that I need to configure the path to the system calls. I am currently 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"); 

arguing that pp puts the script in the \ scripts \ directory, but is not happy. Any suggestions?

+2
perl activeperl par pp
source share
3 answers

Update: My suggestions below do not work. However, I am going to leave them in case anyone has a similar question. This answer shows a lot of things that may sound reasonable, but don't work.

See the discussion after the OP repost for code using $ ENV {PAR_TEMP} , which solves the OP problem

FOR LINK

pp docs say:

-a, --addfile = FILE | DIR ...

By default, files are placed under / inside the package with their original names.

Using the system, you request cmd.exe to find the file, and now I understand that this is probably a losing battle if you do not have a separate executable file called cpau.exe . I don't have time to try this right now, but you may need fork and exec instead of relying on system . How in:

 exec 'CPAU.exe', @args 

Previous answer:

The line passed to system does not contain what you think:

 use strict; use warnings; my $x= "..\cpau -dec -file ..\add_rec.job -nowarn -wait"; print $x, "\n"; __END__ C:\Temp> fgh ..โ–บau -dec -file ..dd_rec.job -nowarn -wait 

Use (edited after OP comment below):

 system "..\\cpau -dec -file ../add_rec.job -nowarn -wait"; 

I would also recommend using the system list form:

 system '..\\cpau', qw(-dec -file ../add_rec.job -nowarn -wait); 

Alternatively, you can find FindBin if you want to specify the path to cpau relative to the current script.

For example:

 #!/usr/bin/perl use strict; use warnings; use FindBin qw($Bin); use File::Spec::Functions qw( catfile ); my $program = catfile $Bin, '..', 'cpau'; system $program, qw(-dec -file ../add_rec.job -nowarn -wait); __END__ 
+3
source share

See the final soul in the message "Where does pp (PAR) decompress add (-a) files?"

+2
source share

I realized that another call to the executable in code is working. I looked and found that a working call uses callbacks, not a system () call. I changed the other callbacks and the problem disappeared.

`. \\ cpau -dec -file. \\ del_rec.job -nowarn -wait`;

So this fixes the problem, buy why? What is the difference between system () and backtic in win32 shell?

He spoke too early. This works in a directory where cpau already exists. When I tried it in c: \ temp, I got "cpau", which is not recognized as an internal or external command, operating program or batch file. "Error. Very frustrating.

I'm at a dead end.

`cpau -dec -file del_rec.job -nowarn -wait`;

I tried this with and without leanding ". \\". Same error anyway.

0
source share

All Articles