perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jasper Zhao <>
Subject [mp2] To get APR::Pool::cleanup_for_exec officially supported
Date Wed, 13 Jul 2011 20:08:40 GMT
Dear mod_perl2 Developers,

As you know when you want to spawn a sub-process and execute an external program you can use
'spawn_proc_prog' defined in Apache2::SubProcess. However, if you want to spawn a sub-process
and call a Perl subroutine, the sub-process won't release the listening port therefore you
cannot restart your httpd daemon if the spawned process is still running.

APR::Pool::cleanup_for_exec comes to rescue. It does some cleanup tasks including releasing
the listening port. See the code snippet below. The method works properly. However in the
mp2 document at the link below, it says this method is an unsupported API. Is it possible
to get it officially supported?

sub fork_and_call_sub
    my $pid = fork();
    if(!defined $pid) {
        die("Cannot fork: $!") 
    if($pid) {
        #Parent process
     # Child goes here
      close STDIN;
      close STDOUT;
      open STDIN, '/dev/null';
      open STDOUT,'>/dev/null';


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message