Re: Problems flushing my buffer! (perl)

On Oct 3, 1:30 pm, Jürgen Exner <jurge...@xxxxxxxxxxx> wrote:
Nigel <ni...@xxxxxxxxxxxxx> wrote:
Hi there,

I hope you can help - I'm writing a perl program and I want it report
back to the browser
on its progress. I read the perl faq and saw that by setting $| true
the buffer would be
flushed each time I printed instead of waiting until the program
terminates. But I can't
get it to work.

I'm expecting the web page to say that it's on the job, then every
second (for 10 seconds) to say Please Wait and then at the end to say
it's finished. But what happens is I wait ten seconds for a response
and the whole lot appears at once. Any advice would be VERY welcome.

The whole lot appears at once _WHERE_?

Run your sample program from the command line and you will notice,that
there is the desired one second pause between each  "Please wait!<br

Of course your web server typically will not transmit the HTTP response
in such small chuncks but wait until it recieves EOF. And a web browser
may not display any HTML-page until it has been downloaded completely.
But neither of these has _ANYTHING_ to do with Perl but would happen
exactly the same way no matter in which programming language the CGI
program was written in.


To clarify - it all appears at once in my web browser.

So it seems I must rephrase my question and perhaps address it to a
different Group as apparently the problem isn't with my Perl as
such...but I am writing this in Perl so I guess I still have a Perl
related question: Is it possible to achieve what I want i.e. to
request my perl program from my browser and have the program tell me
the progress it is making from time to time and have that appear in my
browser in real time? My impression from what I read in the faq (and
elsewhere) was that such a thing IS possible, but perhaps I've
misunderstood. In the worked examples I saw, they talked about
'Forking' - which I understand to mean that one part of the program
responds to the browser, whilst another part carries on with the
processing. I have to say I couldn't really get my head around the
examples I saw which is why I was trying to start off simple! Thanks
for the response anyway.