Ok, i think I know what the problem is now.
I tested my code (guess i was too lazy before).

The problem seems to be the size of the resulting display data. 1 to 5 just wan't enough. I changed the code to iterate from 1 to 500000 and removed the sleep (it works with the sleep, but for me 66 lines had to be printed before anything would display).

My guess is that the browser also has a buffer. The amount of data sent must first fill this buffer before the browser will attempt to display the data it has recieved.

I also discovered when testing my suggestion that on the command line the script buffers the results until it is complete (on the 1-5 iteration). Adding the $| = 1; you had in the code originally helped this. It doesn't seem to make a difference with the large incrementation set.

I know it's not line by line output, but with straight cgi it's probably the best that can be had. Hope it helps.

3 buffers: (+ how to defeat)

P.S.- as i finish this the test script is on "Line 854"


In reply to Re: Re: Re: Re: (OT?) Output buffering w/Apache by bastard
in thread (OT?) Output buffering w/Apache by voyager

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.