You might want to consider using AJAX - it's good for this type of thing. I wrote a demo to illustrate something similar a while back that might be useful to you. | [reply] |
this could be because of buffering. (perl actually does not send one line at a time; it waits for more FIRST unless you tell it differently).
There is a very excellent and easy to understand explanation at: http://perl.plover.com/FAQs/Buffering.html
Probably what you want is:
use IO::Handle;
STDOUT->autoflush;
But do read the FAQ and all will become clear. | [reply] |
Thank you guys, the articles above are really helpful.
This is the question that is little bit off-topic, but related to the pipe: I try to get the time of execution from the pipe, with time() and Time::HiRes, but I found it never accurate...Is this problem common? If so, how can I get the time correctly, especially I work with pipe? | [reply] |
this could be because of buffering. (perl actually does not send one line at a time; it waits for more FIRST unless you tell it differently).
There is a very excellent and easy to understand explanation at: http://perl.plover.com/FAQs/Buffering.html
Probably what you want is:
use IO::Handle;
STDOUT->autoflush;
But do read the FAQ and all will become clear. | [reply] [d/l] |
Thank you your reply. The article is very detail.
I know Buffering will give me the feeling of the dalaying, but the magical thing is: I called time() or Time::HiRes method before pipe call to capture the timestamp before the pipe opened, then I capture another timestamp after the pipe closed; while the program itself will display a time of execution as well. I found the time shown in perl is always less than the time shown in the pipe result largely......I checked the documentation and I am quite sure the time unit is correct and the method I used to get the interval is from the sample code, so I don't think this is the buffering problem...any idea?
| [reply] |