Hi Bill,

Thanks a lot for your codes. But I found it doesn't work also. And I found this 
from apache's website:

"Apache for Windows version 1.3 series is implemented in synchronous calls. This 
poses an enormous problem for CGI authors, who won't see unbuffered results sent 
immediately to the browser. This is not the behavior described for CGI in Apache, 
but it is a side-effect of the Windows port. Apache 2.0 is making progress to 
implement the expected asynchronous behavior, and we hope to discover that the 
NT/2000 implementation allows CGI's to behave as documented." 

Does this mean I should use Unix based server in order to get real time output
of CGI program? Even the following simple program doesn't work on  my system.
(NT+apache 1.3+active perl 5.6)

#!c:/web/perl/bin/perl -w
$| = 1; 

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


for ($i=1;$i<10;$i++) {
        print " Current number is $i ";
        sleep 1;
        }
#_____END


>Tao Li wrote:
>> 
>> Hi there,
>> 
>> I am a newbie to Perl&CGI programming. In order to show real time output
>> of a CGI program on browser, I set $|=1. Although it works in UNIX, it failed under 
>NT+Apache1.3.20+Activeperl5.6. Does anyone have idea how to solve the
>> problem? I don't want to transfer all my works to UNIX right now.
>> Thanks in advance.
>> 
>> Sample code
>> #*********************************
>> #!c:\web\perl\bin\perl
>> $|=1;
>> 
>> print 'Content-Type: multipart/x-mixed-replace;boundary="------here we go!"';
>> print "\n\n";
>> 
>> $i=10;
>> while ($i) {
>>     print "Content-Type: text/plain\n\n";
>>     print "ddddd";
>>     $i--;
>>     sleep 1;
>> }
>
>This should work in Netscape - MSIE will not redraw:
>
>nph-script.pl (should require nph- prefix):
>
>#!c:\web\perl\bin\perl
>
>$| = 1;
>
>my $boundary = "MyBoUnDaRy";
>my $mime_type = "multipart";
>my $mime_subtype = "x-mixed-replace";
>
>print "HTTP/1.0 200 OK\n";
>print qq{Content-Type: multipart/x-mixed-replace; boundary="$boundary"\n\n};
>
>for (1 .. 10) {
>
>       print <<EOD;
>--$boundary
>Content-type: text/plain
>
>$_: ddddd
>EOD
>       sleep 5;
>
>       print ' ' x 4096;       # flush buffer out
>       print "--$boundary--\n";
>       sleep 5;
>}
>
>__END__
>
>You can play around with where the sleep and extra spaces go.
>-- 
>  ,-/-  __      _  _         $Bill Luebkert   ICQ=14439852
> (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED] 
>  / ) /--<  o // //      http://dbecoll.webjump.com/ (Free Perl site)
>-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/


_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web

Reply via email to