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

Hi all, I have written a perl CGI that very simply executes an external application. After it launches I want to to exit the cgi script. Does anyone have any ideas on how to do this? I tried exit(1); but that didn't work. Thanks.

Replies are listed 'Best First'.
Re: Perl CGI exit
by kyle (Abbot) on May 21, 2007 at 13:27 UTC

    You might try exit(0), since that's a successful exit, or just exit with no argument (which is the same thing).

    Is it the case that you want to launch the external application and then exit while it's running? In that case, you need to fork first.

    Update: You might want to see also:

      Basically I want to launch the application and leave it open and running and exit the cgi in the background. I believe that's what your asking.
Re: Perl CGI exit
by cormanaz (Deacon) on May 21, 2007 at 22:26 UTC
    You might also have a look at function exec which "terminates the currently running Perl script by executing another program in place of itself."

    Steve