In addition to what
tilly said about select, in this case there is an additional, and often useful technique to actually SEPARATE the stdout and stderr stream. In IPC::Open3, if you set the \*ERR handle to 0, it will go to stdout, like in IPC::Open2. But what if you wanted your stderr to go somewhere different, or be highlighted in different colors, or go to a log file?. Then the general purpose techique shown above can be used. It is almost the way you would do it in c. Most people forget about select, because many modules handle those details transparently for them.
But it is a cute code fragment, isn't it? You know, us old geeks, drool over elegant time-tested code fragments. :-)
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.