I use IPC::Run3 quite a bit, and it's a good option for retrieving STDIN
and STDOUT from a forked process.

Be aware that with mod_perl2, subprocesses which are forked using system
and backticks (IPC::Run3 uses system) DO NOT INHERIT THE ENVIRONMENT OF
THE PROCESS FROM WHICH THEY ARE FORKED.

You can get around this by explicitly setting them with Env::C, on the
command line using the "ENV1=val1 ENV2=val2 /path/to/prog param1 param2"
syntax, though I don't think that's available to you using
IPC::Run3...don't hold me to that.

Alternatively, you can use the native Apache2 forking code, which is
available in Apache2::SubProcess.

BTW, thanks to Torsten Foertsch who helped me understand this problem in
a thread entitled 'mp2, IPC::Run3 && Environment Variables giving
"variable not set" error' on this list last week.

Not sure that these solutions will work for a threaded MPM either.

Eric

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> Behalf Of Perrin Harkins
> Sent: Wednesday, August 20, 2008 12:47 PM
> To: Niels Larsen
> Cc: modperl@perl.apache.org
> Subject: Re: mod_perl2 STDOUT question
> 
> On Wed, Aug 20, 2008 at 11:26 AM, Niels Larsen 
> <[EMAIL PROTECTED]> wrote:
> > I can put
> > the command line to run in backticks and do print [EMAIL PROTECTED], and
> > that too works, but would like to use system, Proc::SafeExec, etc.
> 
> To fork and capture output without backticks, you have to do something
> with pipes, like the IPC::Open* modules do.  This isn't
> mod_perl-specific and I think you can find some good examples in the
> perl documentation.  Maybe perlopentut would be a good starting place?
> 
> - Perrin
> 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
- - - -

This message is intended only for the personal and confidential use of the 
designated recipient(s) named above.  If you are not the intended recipient of 
this message you are hereby notified that any review, dissemination, 
distribution or copying of this message is strictly prohibited.  This 
communication is for information purposes only and should not be regarded as an 
offer to sell or as a solicitation of an offer to buy any financial product, an 
official confirmation of any transaction, or as an official statement of Lehman 
Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  
Therefore, we do not represent that this information is complete or accurate 
and it should not be relied upon as such.  All information is subject to change 
without notice.

--------
IRS Circular 230 Disclosure:
Please be advised that any discussion of U.S. tax matters contained within this 
communication (including any attachments) is not intended or written to be used 
and cannot be used for the purpose of (i) avoiding U.S. tax related penalties 
or (ii) promoting, marketing or recommending to another party any transaction 
or matter addressed herein.

Reply via email to