Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Executing programs without waiting

by gcoates (Novice)
on Nov 22, 2005 at 21:35 UTC ( [id://510918]=perlquestion: print w/replies, xml ) Need Help??

gcoates has asked for the wisdom of the Perl Monks concerning the following question:

Hi, monks. I need to write several perl CGI scripts that kick off another program, send some information to the browser, and then exit while the other program does its thing in the background. I looked at the exec and system functions, but it looks like these both wait for the called program to return before the parent program will continue or exit. Is there any way to do what I'm trying to do?

Replies are listed 'Best First'.
Re: Executing programs without waiting
by edoc (Chaplain) on Nov 22, 2005 at 21:45 UTC
    fork will let you do what you want to do..

    cheers,

    J

Re: Executing programs without waiting
by GrandFather (Saint) on Nov 22, 2005 at 21:46 UTC

    exec doesn't return to the "calling" program, so you could fork and exec to get that behaviour.


    DWIM is Perl's answer to Gödel

      Here's what I'm trying now:

      #!/usr/bin/perl
      
      $SIG{CHLD} = "IGNORE";
      fork();
      exec("perl set");

      Is this right? The first program still doesn't seem to continue until the child program finishes... What am I missing here?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2024-04-25 06:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found