Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: how to implement

by Hero Zzyzzx (Curate)
on May 16, 2001 at 19:48 UTC ( [id://81051]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to how to implement "tail -f" using CGI

put $|=1; at the top of your script. This will unbuffer output.

in case that's hard to read, it's "$|=1;"

Replies are listed 'Best First'.
Re: Re: how to implement
by mr.nick (Chaplain) on May 16, 2001 at 21:46 UTC
    That doesn't seem to quite work. I wrote the follow test:
    #!/usr/bin/perl $|=1; print "Content-type: text/html\n\n"; for (1..20) { print "$_<br>\n"; sleep 2; }
    and the browser still waits until all 20 numbers are outputted before returning the page.

    This is under IE 5.0, Perl 5.005 and Apache 1.3.19.

    Update: If I increase the range to something higher, I find that around 40 or so, it's starts to output. Apache itself must be doing some buffering ...

      Sorry for being *nix-centric. I only have done perl coding on linux/unix. I don't know how unbuffering behaves on a windows machine. This works perfectly on my linux boxes. Sorry!

        Who said I was doing this on Windows? Ah! The "IE 5.0". Well, my browser is running on Win2k, but everything else is under Linux.

        Btw, it seems that Apache (at least my copy) buffers in 512 byte blocks; regardless of what the CGI itself is doing.

      The guilty party here is IE, not apache. I just compared IE6 to N4.76, both on win2000. IE won't display anything before it has read about 230 bytes. If you then reload the page, there's no buffering.

      quick fix:

      print "<!-- hey IE, display this page already -->\n" x 5;
      --
      Brigitte    'I never met a chocolate I didnt like'    Jellinek
      http://www.horus.com/~bjelli/         http://perlwelt.horus.at

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://81051]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.