Re: Perl CGI persistence question

  • From: "tribble" <lauraeaves@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Sun, 10 May 2009 09:28:44 -0500

PS: Is there such a thing as nohup in perl?
Good luck.
--le

----- Original Message ----- 
From: "tribble" <lauraeaves@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, May 10, 2009 8:34 AM
Subject: Re: Perl CGI persistence question


Hey Sina -- I never did immerse myself much in perl so this may not be of
help, but is there a way in perl to detach a child process, as in a shell
command with an ampersand at the end of the line? I ask because I always
thought perl was partly derived from shell.
The trick is detaching the process, not just forking it.
HTH
--le

----- Original Message ----- 
From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Sunday, May 10, 2009 1: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

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

Other related posts: