Haroon Rafique wrote:
> Hi listers,
> Just needed a quick opinion:
> suggests that Apache::SubProcess be used for executing subprocesses.
> Howerver, in an earlier list message,
> Stas had suggested that either IPC::Run or Apache::SubProcess could be
> I have 2 versions of a mod_perl script using either of the modules. Which
> one would be preferred and why?
> Some reasons come to mind right away, e.g.,
> * IPC::Run may be more mature (version 0.75), so use it.
Don't forget that Apache::SubProcess is just a glue for the C library, which
is quite mature as well. This C library works on all platforms Apache works.
I'm not sure about IPC::Run. Spawning processes on different OSes is quite
> * IPC::Run is a separate install, so don't use it.
> * Apache::SubProcess is distributed with mod_perl, so use it.
IPC::Run should be used instead of IPC::Open3, since the latter doesn't work
under mod_perl. You probably should be able to use any of the two (IPC::Run or
Apache::SubProcess). You could try to benchmark to see which one is faster.
Apache::SubProcess is written in C.
Apache::SubProcess has extra features (see appendix B in the "practical
mod_perl" book and should also be in the guide, but not all were ported yet).
e.g. in mod_perl 1's Apache::SubProcess, you can send the output of system()
to the client:
use Apache::SubProcess qw(system);
my $r = shift;
system "/bin/echo hi there";
but this wasn't ported yet.
in 2.0 you can set subprocess env:
$r->subprocess_env->set(SubProcess => $value);
my $out_fh = Apache::SubProcess::spawn_proc_prog($r, $perl, [$script]);
my $output = read_data($out_fh);
Also you may want to use Apache::SubProcess to stress it out and see if there
is something that we need to fix, if it's not used we might not be aware of
existings bugs that the tests don't catch. You can always switch to IPC::Run
if you encounter some problems.
Stas Bekman JAm_pH ------> Just Another mod_perl Hacker
mod_perl Guide ---> http://perl.apache.org
mailto:stas@... http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org http://ticketmaster.com
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html