> -----Original Message----- > From: Pete Emerson [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 01, 2002 3:34 PM > To: [EMAIL PROTECTED] > Subject: doing work on the side > > > I have a CGI script that downloads data from MySQL and provides a > hyperlink to download the zipped file. > > The problem arises when the data download takes too long, and > the script > times out. Is there a way to have the download part of the > script split > off into the background, show the link, and quit? So that I can say, > "When the data is ready, it will be available at the following URL:"? > Is this what fork() is for, and if so, how do I use it?
Yes, that's what fork is for. You would do something like: my $pid = fork; die "Couldn't fork" unless defined $pid; if ($pid) { # we're the parent ...emit the response to the client (the link)... # parent now can exit exit; } # now we're the child ... do your long-running process here -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]