not really the best way in my opinion....
what you could do is use two scripts.....
first script is the cgi, it does what needs to be done to get the data and
then pipes it to a deamon script that forks off children for each proccess.
The cgi then askes the deamon on the status of its child as the child and
parent has communication between each other. The child will die a natural
death and you could set the deamon to autoreap.
All your cgi will then do is transilate the deamon to the user, basicly
saying. "Sorry.. still busy..." and once the deamon tells you its ok.. the
cgi will read the DBM or whatever you plan to do.
If your a little nerves of all this conversation between deamon and children
and cgi.. you could use temp files with the status.... and you just delete
or change the contents of the tmp file... your cgi will just check whats up
with the tmp.
make sence?
Pierre
----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 19, 2001 12:53 PM
Subject: Do I use fork() for this?
> Hello all,
>
> I'm currently trying to put a little "search engine" together for
> a small web site, basically searching through a bunch of files for
> matching keywords.
> As I want a Progress Page while the script is doing its work, I show
> a page while the script is searching (had to use $| to achieve) and
> store the results in a DBM.
> So when the search/progress script is finished I activate a JavaScript
> doc.location command to call the script again with diff params, thus
> reading the results DBM and outputing page by page.
>
> What I want to do is... put a "kill time" of say 20 mins on the DBM file
> so that it gets tidied away. So...
>
> $child = Fork() {
> some code to Sleep(20 mins);
> then Unlink(results DBM);
> }
>
> What if the client is still accessing the search results at 20 mins?
> I read through PerlDoc perlfork and it recommends not Kill()ing Children.
>
> Can my script, while requests for result pages rain down, communicate
> with the $child (richkid ;o), thus sustaining the $child's life?
>
>
> Probably not the most practical way to achieve my objective,
> but I'm not the best at this programming lark. :o)
>
> TommyGun.
>
> www.y2kdiary.com
>
> -----
>
> 20 email addresses from 15,000 domain names - free at
http://www.another.com
>
>
>
----------------------------------------------------------------------------
----
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]