You're right, of course, that external programs won't honor the new STDOUT. I guess when I read "redirect _all_ of the output from my perl programs," I was thinking more of the output directly generated by the Perl program... But I suppose you would want the output from externally executed commands, too. :-) So, yes, the only choice in that case is to reopen the real STDOUT to a pipe and poll on that. *shrug*

As for what warn does exactly with respect to STDERR... I wish I knew. ;-) I'm guessing that warn and die always write to the real STDERR so that you don't end up with situations where a warning is generated in the code that handles the tied handle (er... yeah) and so warn ends up calling the same code that generated the warning in the first place, possibly resulting in infinite recursion. I'm kind of doubting that's the case, since I think there are probably better (er, IMO) ways to avoid that situation (eg, the same way warnings generated in $SIG{__WARN__} handlers are handled). Again, all I can say is: *shrug*

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.


In reply to Re: Re: (bbfu) Re2: (bbfu) (tied handles) Re: Redirect dos console output to a widget by bbfu
in thread Redirect dos console output to a widget by Merrick

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.