Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: spawning Perl scripts

by dzaebst (Initiate)
on May 13, 2008 at 20:10 UTC ( [id://686356]=note: print w/replies, xml ) Need Help??


in reply to spawning Perl scripts

Tried to do this a while ago and had the same fork/exec problem. It's possible to fork/exec and have the page load. Apache waits for the child process to close off its handles before loading. So you just have to close them manually:
if (!defined( my $child_pid = fork())) { die "Cannot Fork: $!" } elsif ($child_pid) { print "</body></html>"; exit(0); } else { close(STDOUT); close(STDERR); close(STDIN); exec("$my_command"); exit(0); }
If you're planning on launching processes and don't really need a web interface, it's worth considering perl Tk. OK user interface, fewer security issues, and no quirks introduced by apache.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://686356]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2024-04-19 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found