yodha has asked for the wisdom of the Perl Monks concerning the following question:
I have 3 programs. 1 perl script and a java program which are the same. Another main perl script which uses one of the above. The main perl script is shown below.
open(sense,"java Listen -port /dev/ttyUSB0:115200 |")|| die "Failed to + listen"; while(<sense>) { $currentline= $_; print ("Line $currentline"); }
This works fine. Now the second perl script, I had written on my own. I am printing the data collected over the serial port with
This also works fine standalone. But when I replace the java and put the new script on the main (as shown below), it doesn't work. The output is delayed and comes with around 20 lines of data at once.print stdout "$data";
I also tried runningopen(sense,"./read_serial.pl |")|| die "Failed to listen";
I am not sure if the last one is correct or not. I think I should be reading the STDIN, but when I put "-" it dies off. Any help is appreciated. Thanks Thankssystem ("./read_serial &"); open(sense,">- |") || die "Failed to listen";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pipe Input delayed
by ikegami (Patriarch) on Jun 28, 2011 at 19:29 UTC | |
by yodha (Initiate) on Jun 28, 2011 at 20:57 UTC | |
by jwkrahn (Abbot) on Jun 28, 2011 at 21:02 UTC | |
by ikegami (Patriarch) on Jun 28, 2011 at 21:17 UTC | |
by yodha (Initiate) on Jun 28, 2011 at 23:14 UTC | |
by ikegami (Patriarch) on Jun 28, 2011 at 21:09 UTC | |
|
Re: Pipe Input delayed
by ReturnOfThelonious (Beadle) on Jun 28, 2011 at 21:00 UTC |