Re: Gtk2::Helper or Glib::IO event watcher problem



On Tue, 2005-03-22 at 13:45 +0300, Vyacheslav Dikonov wrote: 
I need to write a perl script that would act as a frontend to another perl 
script and show its console output in a non-locking "realtime" manner. The 
...
The problem is that the event callback seems to be triggered only once 
when EOF is received. I need it to occur either when a newline appears 
in the pipe (backend prints "\n") or by every single character. I have 
no clues on how to make the watcher act as needed and my frontend draw 
messages one-by-one instead of one bulk line after an hour long wait.

Have you set $| = 1 in the backend script?  By default, if a program's
STDOUT is connected to a TTY device the output is unbuffered, but if the
same program is connected to a pipe the output is buffered.  Setting
Perl's $| variable to true causes the buffer to be flushed on each
print.

Regards
Grant




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]