in reply to unbuffering I/O with objects

The behavior you desire is not supported. A browser does not behave like a terminal. You can't just "print" to it and have things show up in sequential order.

If you're trying to get "status" messages out to the browser before the HTML (and after you've printed the Content-type: header), one option is to print the status messages as HTML comments, then examine the resulting source to see the status messages. The resulting source would look like

<!-- status: input buffers are out of cheese --> <!-- status: rendering algorithm is full of fleas --> <html> ... </html>

Now if your purpose it to show a temporary message on the browser while you perform some longer operation that'll result later in a page of HTML, merlyn just happens to have an article that shows one way to do it.

Update: I should have said "not universally supported." It's true that some browsers can be coaxed into printing text that appears outside of <html>..</html> tags, but any solution that depends on this is neither horizontally portable (across browsers) or temporally portable (across new browser releases).

Replies are listed 'Best First'.
Re: Re: unbuffering I/O with objects
by geektron (Curate) on Mar 23, 2001 at 13:49 UTC
    i hate to say anything nice about M$ products -- but IE ( 5.0 ) gives me the behavior i want - Netscape ( 4.73 ) doesn't.

    and it can be done -- it's a matter of manipulating the way the browser performs its rendering tasks.

    update: i checked Mozilla's rendering, and it performs as desired as well.

    so it's a matter of getting Netscape to cooperate

      A standard browser is not required to "partially render" a page. The fact that some browsers try to make sense of the input stream as seen so far is merely gravy. It's not that Netscape 4 is deficient—it's that some other browsers are trying to be uber-friendly.

      -- Randal L. Schwartz, Perl hacker

        it may not be a 'requirement' -- but even Netscape ( I _really_ should be saying Communicator - Netscape was a company and is now a brand, but i digress. . ) will give the desired results with a combination of unbuffered output and <BR> tags.

        i was trying to avoid using the vertical real estate if possible.