[ic] Trouble with Document->send()

Mike Heins mikeh@minivend.com
Fri, 4 May 2001 11:29:27 -0400


Quoting Joachim Leidinger (jojo@blackpoint.de):
> Hi list,
> 
> i try
> 
> [loop arg="1 2 3" send=1]
> [perl]
>      my $out = " ";
>      $Document->hot(1);
>      my $i = 0;
>      for ($i = 1; $i <= 10; $i++)
>      {
>      $out .= " $i ";
>      select(undef,undef,undef,1.000);
>      }
>      $out .= "<br> Next process <BR> ";
>      $Document->send($out); # flush buffer
> return '';
> [/perl]
> [/loop]
> 
> and i want to display
> 
> 1 2 3 4 5 6 7 8 9 10 
> Next process 
> 
> three times immediately every 10 seconds. But i get
> 
> 1 2 3 4 5 6 7 8 9 10 
> Next process 
> 1 2 3 4 5 6 7 8 9 10 
> Next process 
> 1 2 3 4 5 6 7 8 9 10 
> Next process 
> 
> *after* 30 seconds.
> 
> Why is 
> 
>  $Document->send();             # Send write buffer array to output,
> done
>                                 # automatically upon end of ASP, clears
> buffer
>                                 # and invalidates $Document->header()
>  $Document->hot(1);             # Cause writes to send immediately
> 
> not working? 

Because there is a buffer that needs to fill up via the vlink/tlink
program. One way to fill it is to send 1024 characters of whitespace at
the end of what you want to send.

Also, your HTTP server may have ideas about what to do with output when
it is not in NPH mode.

-- 
Red Hat, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <mheins@redhat.com>

Being against torture ought to be sort of a bipartisan thing.
-- Karl Lehenbauer