Perl CGI script to not wait for a subprocess to complete

Posted by Tyug on Stack Overflow See other posts from Stack Overflow or by Tyug
Published on 2010-04-19T14:22:44Z Indexed on 2010/04/19 14:23 UTC
Read the original article Hit count: 228

Filed under:
|

Is it possible to continue displaying a CGI script's HTML without waiting for a child process to complete, yet the child process should stay alive when the CGI script is complete.

Here's what I have,

-- Display HTML page

# html page set up... so header/other stuff

#the -c, -h are params are just params
system("perl subprocess.pm -c params -h 1 &");

#actually print the html page setup
...

For some weird reason, it waits for the subprocess to finish before it outputs the html page even though I included the asynchronous system call for linux. It doesn't render the page immediately. Is it possible to print the html page without waiting for the subprocess to finish?

© Stack Overflow or respective owner

Related posts about perl

Related posts about subprocess