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

For fun and experience, I'm rewriting one of my ASP applications as a CGI job with Perl. So far so good, but is there a way to control how the output to the browser is buffered? For example, in ASP, I can write:
Response.Buffer = True ' Do some stuff Response.Flush ' More stuff
This comes in handy because the app does some long-winded database searching. Are there equivalent commands in a module somewhere?

Replies are listed 'Best First'.
Re: (CGI) ASP-like response buffer control
by MZSanford (Curate) on Aug 22, 2001 at 19:30 UTC
    for code that is about to "hang" (user words) for a long time, i usually add $| = 1; so that there is no buffering to STDOUT, and the data will be written immediatly.
    can't sleep clowns will eat me
    -- MZSanford
Re: (CGI) ASP-like response buffer control
by perrin (Chancellor) on Aug 22, 2001 at 20:00 UTC
    Check the perlfaq for info on unbuffering STDOUT. You also need to find out what buffering your server does, if any. You may find the CGI.pm documentation helpful for this as well.

    You might want to look into using Apache::ASP, if you're comfortable with the ASP paradigm.