You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Demetrios C. Christopher" <dc...@darwinmail.net> on 2001/02/28 20:51:24 UTC

Apache::ASP, Response->Flush problems ...

Hello all,
due to some issues with long-running scripts and impatient users
we decided to display some sort of message (either in the window
or in a popup - better!) that would say "Chill out, don't refresh
or double-click" etc, etc.  I was trying to take advantage of
$Response->{Buffer} and $Response->Flush() but apparently it does
not work.  Clearing and Flushing may work in the "end product"
which is what you see on your browser but the timing is not correct.
That is, when I say "$Response->Flush()" I actually want the user
to see the output thus far.  My ASPs unfortunately will not display
the source until the last statement has been executed and then the
source will be received in its entirety.  What I meant by "end
product" by the way is: if I do something similar to Josh's sample
response.html file and say:

print a bunch of stuff
Response->Flush
print something here
if I should clear this
 { Response->Clear }
do other things

then the above statements will take the proper effect and either
show the "print something here" or not depending on the conditional.
The problem is I won't see the "print a bunch of stuff" until the
end of script (so if there was a noticeable delay in "do other things"
I'd have to wait for them to finish until I could see "print a bunch
of stuff").

Any help would be greatly appreciated.

DCC

P.S. I tested the timing of the output returned by telnet'ing
to port 80 and using sleep(x) right after Flush().  The start of
the output has to wait for the completion of the script in all
instances.

Re: Apache::ASP, Response->Flush problems ...

Posted by Joshua Chamas <jo...@chamas.com>.
"Demetrios C. Christopher" wrote:
> 
> Hello all,
> due to some issues with long-running scripts and impatient users
> we decided to display some sort of message (either in the window
> or in a popup - better!) that would say "Chill out, don't refresh
> or double-click" etc, etc.  I was trying to take advantage of
> $Response->{Buffer} and $Response->Flush() but apparently it does
> not work.  Clearing and Flushing may work in the "end product"
> which is what you see on your browser but the timing is not correct.
> That is, when I say "$Response->Flush()" I actually want the user

It should work, the code that's relevant in Apache::ASP::Response::Flush(),
but its seems not to be working for me either.  My real problem
here is that I've fixed this before, so I obvi need to create a decent
make test case for this routine.  My humble apologies.

I'll get back to you when I have this fix.

--Josh
 
_________________________________________________________________
Joshua Chamas			        Chamas Enterprises Inc.
NodeWorks >> free web link monitoring	Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

Re: Apache::ASP, Response->Flush problems ...

Posted by Joshua Chamas <jo...@chamas.com>.
"Demetrios C. Christopher" wrote:
> 
> Hello all,
> due to some issues with long-running scripts and impatient users
> we decided to display some sort of message (either in the window
> or in a popup - better!) that would say "Chill out, don't refresh
> or double-click" etc, etc.  I was trying to take advantage of
> $Response->{Buffer} and $Response->Flush() but apparently it does
> not work.  Clearing and Flushing may work in the "end product"

The old $Response->Flush() functionality will be back in 2.11.  
If you'd like my latest copy, I can send it to you, or you can 
patch up ASP.pm yourself:

*** ASP.pm~     Mon Feb 26 19:40:09 2001
--- ASP.pm      Wed Feb 28 18:43:43 2001
***************
*** 3392,3397 ****
--- 3392,3398 ----
        #        unless($self->{r}->connection->aborted) {
        # OK to print random ouput for 200's & 300's
        if(! defined $self->{Status} or ($self->{Status} >= 200 and $self->{Status} < 400)) {
+           local $| = 1;
            $self->{r}->print($out);
        }
        #       }

This change in mod_perl behavior really killed me.
Funny little thing, but at least its more perlish. :)

--Josh
_________________________________________________________________
Joshua Chamas			        Chamas Enterprises Inc.
NodeWorks >> free web link monitoring	Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051