To buffer or not ($|)

2004-12-29 Thread Jan Eden
Hi all,

I already sent this as a reply to another post, but did not receive an answer. 
In the following script, the results are not printed at once, line by line, but 
in one block after several seconds:

___BEGIN CODE___

#!/usr/bin/perl -wT

use CGI;
use strict;
use LWP::UserAgent;

my $q = new CGI;

print $q-header(-type='text/html', -charset='utf-8'),
   $q-start_html(URL-Checker),
   $q-h1('URL-Checker');
   
if ($q-param) {
   my $input = $q-param('input');
   my @urls = split /[\r\n]+/, $input;
   my $fh = $q-upload('input_file');
   while ($fh) {
   my @line = split /[\r\n]+/;
   push @urls, @line;
   }
   for (@urls) {
   $_ = http://; . $_ unless /^http/;
   my $browser = LWP::UserAgent-new( );
   $browser-requests_redirectable([]) if ($q-param('no_redirect'));
   my $response = $browser-get($_);
   if ($response-status_line eq 200 OK) {
   print qq{pspan style=color:green'$_'/span is valid/p};
   }
   else {  
   print qq{pspan style=color:red'$_'/span is not validbr 
/bResponse status:/b }, $response-status_line, /p;
   }
   }
}
else {
# html form is displayed here
}

print $q-end_html;

___END CODE___


I would expect that $| = 1 alters this behaviour - but it doesn't. Why?

Thanks,

Jan
-- 
Imagine if every Thursday your shoes exploded if you tied them the usual way. 
This happens to us all the time with computers, and nobody thinks of 
complaining. - Jeff Raskin

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response




Browser times out

2004-12-29 Thread Denzil Kruse
Hi all,

I think I'm having a problem with my browser timing
out because my cgi script is taking too long.  The
script processes some database records.  When it does
250 of them, it takes about a minute or so, and the
browser has no problem.  But when I do more, the
script takes about 2 or 3 minutes, and the browser
gets an incomplete response.

Is there a way to tell the browser to hang around a
bit longer to wait for a response?  Or is there
another way to keep the browser's attention so it
knows it has a live connection and to wait?

Thanks,
Denzil



__ 
Do you Yahoo!? 
Yahoo! Mail - Helps protect you from nasty viruses. 
http://promotions.yahoo.com/new_mail

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/ http://learn.perl.org/first-response