Hi Monks,

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

print stdout "$data";
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.

open(sense,"./read_serial.pl |")|| die "Failed to listen";
I also tried running
system ("./read_serial &"); open(sense,">- |") || 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 Thanks

In reply to Pipe Input delayed by yodha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.