H
Hal Vaughan
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
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