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?

Have found a solution but am still puzzled

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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.