I have been running a program that assembles parameters for an executable program and ends by saying
exec $command;where $command is the executable (it happens to be a secure FTP client) followed by some options.
I can run my $command manually in a command window, with the same outcome as when perl gives it to exec.
But now I want to start checking that FTP has actually finished downloading the files I've requested, so I've tried
system $command;But not only does my program not get back control to run my checks, the command actually fails to run:
Why such a big difference between what I can do with exec and with system?
(I run Perl 5.8 on Windows Server 2003.)
Update: FWIW, $command is actually ftpscrpt -w $password -f $script_file, where ftpscrpt is the script utility of a proprietary secure FTP client. I originally left this vague because I didn't think it would be of interest. Whatever it is, it works with exec, fails with system. Isn't that strange?
Inspired by the anonymous response below, I started tweaking things. Looked in the program directory, changed ftpscrpt to ftpscrpt.exe with no luck, looked again at the directory and changed to ftpscrpt.com and it worked the way perlfunc had originally led me to believe it should.
My more general question remains - how do I reconcile my experience with what I read in system, namely
system LIST
Does exactly the same thing as "exec LIST", except that a fork is done first, and the parent process waits for the child process to complete.
Update: My thanks to rovf and salva for their excellent suggestions, which I look forward to trying out in my spare time. The lesson I'll take to heart is that my perl is not identical with the Perl of the manpages, and IPC is one domain where the differences need watching.
In reply to [Have solution now but am still puzzled] Why can't I give system the same command I've been giving to exec? by Narveson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |