[sf-perl] Async or Sync
Adam.Morgan at safeway.com
Sat Mar 10 11:13:15 PST 2007
You can also open a FILEHANDLE that has it's input piped in from a
system process. This would allow you to do other things in your code and
return to the input when you or it the data is ready. I don't know if
this is truly asynchronous because the pipe will halt the system process
when it has some preset amount of data waiting on it.
eg. open(INDATA, "system_command |");
From: sanfrancisco-pm-bounces+adam.morgan=safeway.com at pm.org
[mailto:sanfrancisco-pm-bounces+adam.morgan=safeway.com at pm.org] On
Behalf Of David Alban
Sent: Saturday, March 10, 2007 10:48 AM
To: San Francisco Perl Mongers User Group
Subject: Re: [sf-perl] Async or Sync
system PROGRAM LIST
Does exactly the same thing as "exec LIST", except that a
is done first, and the parent process waits for the child
process to complete. Note that argument processing
depending on the number of arguments. If there is more
one argument in LIST, or if LIST is an array with more
value, starts the program given by the first element of
list with arguments given by the rest of the list. If
only one scalar argument, the argument is checked for
metacharacters, and if there are any, the entire argument
passed to the system's command shell for parsing (this is
"/bin/sh -c" on Unix platforms, but varies on other
If there are no shell metacharacters in the argument, it
split into words and passed directly to "execvp", which
On 3/10/07, Neil Heller <nheller at silcon.com> wrote:
> When I launch a program from within a Perl script via a "system" call,
> is the return asynchronous or synchronous?
I believe "waits for the child to complete" answers this question.
> Is there any way to specifically
> control that from within the calling script?
fork() and exec()?
Call system() with a command ending in ampersand (to get asynchronous
Call system() with a command that will itself call other things
asynchronously (and thus, has the potential to return right away)?
Live in a world of your own, but always welcome visitors.
SanFrancisco-pm mailing list
SanFrancisco-pm at pm.org
"MMS <safeway.com>" made the following annotations.
All e-mail sent to this address will be received by the Safeway corporate e-mail system, and is subject to archival and review by someone other than the recipient. This e-mail may contain information proprietary to Safeway and is intended only for the use of the intended recipient(s). If the reader of this message is not the intended recipient(s), you are notified that you have received this message in error and that any review, dissemination, distribution or copying of this message is strictly prohibited. If you have received this message in error, please notify the sender immediately.
More information about the SanFrancisco-pm