Mailing List Archive

Unbuffered Output
Hi,

I am returning a rather lengthy result of a database query and I want to
unbuffer the page so the results start returning before the entire page is
generated. Do I use optEarlyHttpHeader?

I am currently using the CGI script method embpcgi.pl to invoke embperl. How
do I temporarily set the unbuffering for just this one page?

Thanks,
Phil Hersh
RE: Unbuffered Output [ In reply to ]
Hi,
>
> I am returning a rather lengthy result of a database query and I want to
> unbuffer the page so the results start returning before the entire page is
> generated. Do I use optEarlyHttpHeader?
>

Yes

> I am currently using the CGI script method embpcgi.pl to invoke
> embperl. How
> do I temporarily set the unbuffering for just this one page?
>

optEarlyHttpHeader must be set before the script starts, i.e. via SetEnv
EMBPERL_OPTIONS xxx, but Apache let you do this only for the whole (virtual)
host.

So what I would do is to copy embpcgi.pl to another name and put a

$ENV{EMBPERL_OPTIONS} |= 64 ;

at the top of the script.

Hope this helps

Gerald

-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925151
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
RE: Unbuffered Output [ In reply to ]
On 22-Jun-2000 Gerald Richter wrote:
>
> optEarlyHttpHeader must be set before the script starts, i.e. via SetEnv
> EMBPERL_OPTIONS xxx, but Apache let you do this only for the whole (virtual)
> host.
>
> So what I would do is to copy embpcgi.pl to another name and put a
>
> $ENV{EMBPERL_OPTIONS} |= 64 ;
>
> at the top of the script.
>
> Hope this helps

I have a embperl html file that takes a while to finish executing, so I'd like
to get this working as well.

I tried the SetEnv EMBPERL_OPTIONS 2112, but that didn't work. I also tried
adding a
[- $ENV{EMBPERL_OPTIONS} |= 64 ; -]
to the top of the html file, but that didn't work either.

Am I missing something here?


Regards,

Wim Kerkhoff, Software Engineer
NetMaster Networking Solutions
wim@netmaster.com
RE: Unbuffered Output [ In reply to ]
> I tried the SetEnv EMBPERL_OPTIONS 2112, but that didn't work.

That should work.

> I
> also tried
> adding a
> [- $ENV{EMBPERL_OPTIONS} |= 64 ; -]
> to the top of the html file, but that didn't work either.
>

No, this can't work, because Embperl need to know this before the page
start.

> Am I missing something here?
>

Apache (when running under mod_perl) does some buffering. You can avoid this
by setting $dbgFlushOutput = 1, but this make your script very slow, because
very small packets will be send over the net. If you have a point where you
want to be sure that all buffers are flushed, do a

[-$dbgFlushOutput = 1 -] [-$dbgFlushOutput = 0 -]

(The space between the brackets is important!)

The other things is, that if you are inside a table, your browser will not
display
the page until it has seen the end of the table.

And I forgot one very important thing in my previous mail: If you are
running as CGI script, Apache will buffer the whole script, before it sends
it to the browser. You can avoid this by starting the name of the CGI script
with nph- (you still have to set optEarlyHttpHeader). The nph- handling
under Win32 doesn't work quite well, but under Unix it does.

Gerald


>
> Regards,
>
> Wim Kerkhoff, Software Engineer
> NetMaster Networking Solutions
> wim@netmaster.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>