Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Using exit

by Anonymous Monk
on Dec 30, 2004 at 16:41 UTC ( #418305=note: print w/ replies, xml ) Need Help??


in reply to Re: Using exit
in thread Using exit

Tried but it doesn't work the way I want cause when I use sleep(3); it doesn't display what I already have processed on the browser it just seats there and of course "sleep" for 3 seconds. and using exit displays everything at that point to the browser, I just need some similar trick to display whatever at some point in my program and than move on.


Comment on Re^2: Using exit
Re^3: Using exit
by geektron (Curate) on Dec 30, 2004 at 16:47 UTC
    if you're trying to get things to display to the browser, there are other things to do:
    $|++;
    to force writes to be "immediate". (i'm forgetting the proper term .. not enough coffee yet this morning ... )

    the reason  exit is sending the output to the browser is because the write buffer is closed, like a  close on a filehandle.

Re^3: Using exit
by eieio (Pilgrim) on Dec 30, 2004 at 16:48 UTC
    It sounds like you are developing a CGI application. If this is the case, turning off output buffering may ensure that the output from the script is displayed in the browser:
    $|++;
      Yes I am, and I am using $|++ already, but at some point I would like to have what the exit does but no success yet.
        then you're between a rock and a hard place.

        you may need to refactor the output ... so that you're sending stuff more frequently .....

        without seeing any code, that's probably the best any of us can do ...

        The behavior may be browser dependent. I've noticed that Safari on Mac OS X doesn't incrementally load pages even if the output buffering is disabled by the script. However, Firefox does incrementally display the page.

        While more complicated, a solution developed by Randal Schwartz may be more appropriate, if you are trying to provide incremental feedback during a long-running operation.

Re^3: Using exit
by revdiablo (Prior) on Dec 30, 2004 at 19:07 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://418305]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (4)
As of 2014-11-29 06:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (203 votes), past polls