Hey monks,

I need to write a CGI program that flashes a message on the screen, while it does a big time-consuming process.

Prob is that the browser hangs, while the process is going, then flashes the message when it's all ended.

How can I get the code to flash the message, stop HTTP, and then continue with the big process?

I tried closing STDOUT after flashing the message, but that tends to terminate everything (which shouldnt, since after all I am closing standard output, but shouldnt close the program down.

Thanks!

Here's my code:

sub logmining'start { my ($xtract); my ($userEmail, $head, $foot, $myFile); my (@range); $head = &logmining'PrintHeader (); $foot = &logmining'PrintFooter (); # FLASH MESSAGE: print "$head<tr bgcolor=\"#EBEBEB\"><td><span class=\"texthead\">T +he data is now being processed. Once it is done, you will get an ema +il with all the results that will be sent to $userEmail.</span></td>< +/tr>$foot"; print STDERR "\n\n===== START =====\n"; # Get range of dates @range = &logmining'getDateRange (); foreach $myFile (@range) { # TIME CONSUMING PROCESS: print STDERR "gunzip -c $myFile | grep \"01225322|2199592\"\n\ +n"; $xtract = `gunzip -c $myFile | egrep "01225322|2199592"`; last; # JUST RUN ONE FOR NOW PLEASE! } print STDERR "XTRACT:\n$xtract\n\n"; exit (1);

Robert


In reply to Why does close(STDOUT) terminate my program? by rzs96

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.