in reply to Perl CGI timeout

Make the on-line script just log the request and return immediately, with a message like "your query is being processed - you will receive the result in your mail box."

Have another process make the database/mail processing, possibly using a queue.

Replies are listed 'Best First'.
Re^2: Perl CGI timeout
by jewang (Initiate) on Dec 02, 2004 at 20:49 UTC
    fglock: Thanks for the response. But what do you mean "log the request" and "using a queue"?
    This is how I get the request in the cgi script:
    my $beginDate = $query->param('beginDate') ? $query->param('beginDate') : "";
    my $endDate = $query->param('endDate') ? $query->param('endDate') : ""
    ; my $region = $query->param('region') ? $query->param('region') : "";
    my $frmdept = $query->param('dept') ? $query->param('dept') : "";
    my $frmstorelist=$query->param('storelist') ? $query->param('storelist') :"";
    Then I pass them to "cost_movement_query.pl":
    my $command="/inetpub/dev/wangj/Vim_Stella/cost_movement_query.pl $region $storeList $frmdept $beginDate $endDate"; exec("$command");
    In "Cost_movement_query.pl", I run the SQL and send the email.
    How can I use the queue
    thanks.
    Jewang

      "log the request" - write the query to a file.

      "using a queue" - read the queries back and process them, one at a time. You can even use "cron" to coordinate the calls to "Cost_movement_query.pl".