Arm123 has asked for the wisdom of the Perl Monks concerning the following question:

I am writing a mod_perl2 apache handler... I was performing some form data parsing and feeding the data to mysql database. I was also working on a progress indicator. This is where im having the problem. I cant seem to figure out how to get apache to dynamically feed the status messages directly to the browser / client. Ill try to elaborate on this. I want the page that is generated to have status messages print, to correspond to the give tasks that are being performed and their resulting success or failure. Of course i can generate the output and print it to the client, but it ALL gets printed at once, on task completion. Quite a bit of time passes by whenthe script is running and i would like the messages to be printed progressivly as the script executes. I have seen this feature used on other sites and i have analyzed the output given by the servers. It seems as if the server prints the content length before each line. Im not sure where my problem lies... STDOUT buffering ? or using the RequestIO modules $r->puts() or $r->write() methods. Or perhaps setting the content length for each line / message printed ? I have googled for hours, experimented and have gotten nowhere. Any ideas are appreciated.

Replies are listed 'Best First'.
Re: mod_perl progressive STDOUT indicator
by bibliophile (Prior) on May 07, 2007 at 01:10 UTC
Re: mod_perl progressive STDOUT indicator
by cormanaz (Deacon) on May 07, 2007 at 01:01 UTC
    I don't know the answer to your question but if you want to see if it's STDOUT buffering add $| = 1; to the beginning of your script.

    Cheers...

    Steve