Igor Shevchenko wrote:
On Saturday 19 February 2005 03:06, Stas Bekman wrote:

What about?
$r->spawn_proc_prog
http://perl.apache.org/docs/2.0/api/Apache/SubProcess.html#C_spawn_proc_pro
g_


Thanks for those links, Stas! I had to find them by myself as they are in docs...

The following worked for me:

A helper subroutine:

sub safe_exec {
    my $out_fh = $apr->spawn_proc_prog ( '/path/to/exec_helper.pl', [EMAIL 
PROTECTED] );
    close $out_fh;
}

I've just committed a change which does this for you if you call that method in a void context, so the above can be changed into:


  $apr->spawn_proc_prog ( '/path/to/exec_helper.pl', [EMAIL PROTECTED] );

And a helper script:

#!/usr/bin/perl -w
use strict;
use warnings;
use POSIX;

performance-wise this is silly :) See 13.5.2 in http://modperlbook.org/html/ch13_05.html for details.

POSIX::setsid;

close STDIN;
open STDOUT, '+>>', '/path/to/apache/error_log';
open STDERR, '>&STDOUT';

exec ( @ARGV );

why do you need to call exec() here? It doesn't detach if you don't call it? I think it should make no difference at all.


CORE::exit(0);


--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

Reply via email to