Re: Perl CGI persistence question

  • From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 10 May 2009 08:25:19 +0100

Hi Sina,

 Does anything on this page help:

http://coding.derkeiler.com/Archive/Perl/perl.beginners/2003-11/1148.html

 Regards, Martin


----- Original Message ----- From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, May 10, 2009 7:37 AM
Subject: Perl CGI persistence question


Hi all,

I've got a CGI script written in Perl, and it seems to work just fine for
the most part; however, I have the following problem.

My script takes in some input, via a form, executes many calculations and so on with that data, and then emails the user when its done, with the results.

The problem is that these calculations, as a result of other IO issues, take some time to execute, on the order of minutes. No matter what I do, I can't
fork off a process or do something else that allows me to just allow the
html page to finish loading, give the user some output like, "the results
will be emailed to you", and then to continue executing, while they navigate
away, close their browser, or whatever.

Here's the end of my script, after all the output and such:

***

print p."Your request has been received, and an email will be sent with your
results shortly";

if(fork() == 0) {
doCalc;
sendEmail;
return;
}
  }

print end_html;

***

I was hoping the child would execute away, while the parent returned the end html ... But no, the page doesn't finish loading until the calculations are
done.

Is there some standard Perl or CGI way of doing this?

Take care,
Sina

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind




__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: