Friday, July 31, 2009

How do I enable fushing in perl (CGI)??

Hi! I'm working on a script that should flush the output without buffering it, during a file upload. I tried using $|=1, and while that works when there's no file being sent (like when running the script without any argument). My script looks something like this:





print "Content-type: text/html\n\n";





$| = 1;





while ( read ( STDIN, $dummy_var , 4096 ) )


{


print 'output%26lt;br%26gt;';


sleep(1);


}





Your help is greatly apreciated. Many thanks!

How do I enable fushing in perl (CGI)??
that is a simple read write, with a silly delay, and the buffering is turned off.... BUT...





cgi isn't cgi isn't cgi! which server? modperl? fastcgi? weird config?





UPDATE:





hmm active state... a good port for a great webserver on an problematic O/S!





try something like "for ... print %26lt;img...%26gt; in the loop, with a greater delay... does that work?





perhaps the STDIN did not have more than 4096 chars in it!





my number 1 rule of debuggin'


remove all but the problem and see if the problem goes away!


No comments:

Post a Comment