CGI: Running a forked background process



I have a web page (served up by Apache 2) where a user click a link to
download a file. The link calls my Perl CGI script which takes the
parameters and generates a file to download. It takes time to generate the
file, so my idea was to fork like this:

if (!fork()) {
system("$ifile person=$id location=$loc");
exit();
}

And while the forked program is generating the download file, another web
page pops up saying, "Please wait..." and includes a Javascript countdown
until the next time it'll check and see if the download is ready. That
way, when the user clicks a link, they don't have to wait and get a new
page immediately. The new page has a countdown to let them know they're
not forgotten.

I've found, though, that the fork is not working. When I click on the link,
I get a LONG pause and eventually the countdown page appears, but only
after the forked program is done with it's work.

How can I fork so the download file is generated in the background, without
delaying displaying the other page?

Thanks!

Hal

.



Relevant Pages

  • Re: Where to download Mark Fletchers ResourcePackage?
    ... Duh... ... Gusess I took the wrong fork in the road when I decided to get out of bed ... > Thomas Heller suggested this to me and I want to download it... ...
    (comp.lang.python)
  • File download in background.
    ... I posted this to this list as it's as much a fork() issue as a CGI ... having the file download happen in the background as it's not ... are pouring the content into the browser window. ...
    (perl.beginners)
  • Re: Tk and subprocesses
    ... and this work but I want to download pages in parallel processes or some ... I tried to use fork() but this crash the script. ... -command => sub { ...
    (comp.lang.perl.tk)
  • Re: OFFICE 2003 ACCESS
    ... to fork out for the office 2003 Professional edition which includes access, but wait is it possible to buy or download just the Access program? ...
    (microsoft.public.windowsxp.general)
  • Re: GGC2006
    ... download a free file called COUNTDOWN! ... and you'll have an ideal clock for cruises. ...
    (rec.travel.cruises)