
xsustek
New User
Dec 2, 2010, 10:07 AM
Post #1 of 3
(761 views)
|
Readin STDOUT of external program through a pipe
|
Can't Post
|
|
Hi, I need to read a STDOUT of an external program in my perl script. The thing is that that program is running all the time and I need to react immediatelly after it outputs every line. What happens is that when the external program outputs a line, my script doesn't do anything because that line is somewhere buffered. I tried $|=1, but did not work. This is the code:
#!/usr/bin/perl open (IN,'monbro -N monitor_definition |' ) or die "Error"; $|=1; while ($line = <IN>) { print $line; } close IN; I the prob
(This post was edited by xsustek on Dec 2, 2010, 1:08 PM)
|