in reply to Keep running script but ending it to the browser

Why not use the CB suggestion, which if I understood it correctly, would be along the lines of (assuming *NIX-like OS)...
END { system "at now + 5 secs 'rm $tempfile'"; }
In this way, your perl script has handed over responsibility for the file deletion to the underlying OS immediately before ending - hence the connection to the browser will be dropped straight away.

Again assuming *NIX OS, man at should clear up any syntactical probs contained within my suggestion.

HTH ,

A user level that continues to overstate my experience :-))

Replies are listed 'Best First'.
Re^2: Keep running script but ending it to the browser
by JavaFan (Canon) on Aug 07, 2008 at 16:32 UTC
    Not on my system, and probably not on many other systems either. The UID the webserver is running is in /etc/at.deny (and /etc/cron.deny) and hence CGI programs will not be able to do remote-time execution.
      Never thought of that JavaFan.

      OK, how's about...

      END { system "nohup sleep 5 ; rm $tempfile >/dev/null 2>&1 &"; }
      or similar ...

      A user level that continues to overstate my experience :-))
        Thanks. I am now using your suggestion:
        END { system "nohup sleep 15 ; echo test >/dev/null 2>&1 &"; }
        However inside the shell if the script is executed, it ends succesfully but then waits for 15 seconds before returning to the shell. Inside the browser the same thing happens, exactly 15 seconds after requesting the page, the page is returned. To see the problem I have added a time counter and the runtime is only around 0.2 seconds but it takes 15.2 in reality. Am I implementing the code wrong?