[Catalyst] Streaming (again)

Mark Ethan Trostler mark at zzo.com
Fri Sep 1 02:55:22 CEST 2006


Ok saw the previous thread on streaming so this should be drop-dead 
simple but it's not working - I'm trying to stream plain text (a la 
'tail -f') to the browser.  I'm using FastCGI in standalone server mode 
- apache 1.x.

Simplified:

sub tail : Local {
     my($self, $c) = @_;

     $c->res->content_type( 'text/html' );

   my $i = 5;
   while($i) {
         $c->res->write("$i<br/>");
         $i--;
         sleep(1);
     }
    exit;
}

I want to see one line at a time BUT it doesn't show up until after 5 
seconds of 'loading' the page & then it's all there at once.

I've tried c->write(), $c->res->body(), $c->res->output() & whatnot...

What do I need to do to get this to work???

   thanks!!!
		Mark



More information about the Catalyst mailing list