But if you want your script to look through the output while it's between the two processes to check for errors and such, you do need the loop with the read/write. If point each process at one end of a pipe you created, it will go on without your involvement. Maybe you can use the efficient pipe for stdout/stdin but still monitor stderr within the script.
I wrote a filter to act as a sniffer for a specific network protocol. I wrote code in Win32 to use IO completion ports to efficiently move the buffer from one to the other without copying it, and also passed it to an embedded Perl interpreter as a "tee" in the middle. The Perl could do its fine job of parsing the stuff and presenting it to me, but the processes piped efficiently as long as I didn't select the option for modification of the data stream by the Perl code (that is, report only). I used the modification ability to introduce errors or otherwise test things that my well-behaved program never did.
—John
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.