Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Redirecting STDERR to a variable

by teabag (Pilgrim)
on Sep 12, 2003 at 15:15 UTC ( #291091=note: print w/replies, xml ) Need Help??


in reply to Redirecting STDERR to a variable

I had the same problem recently while writing a perlTk script. I found out it helped me to use the perl tie command.

tie(*STDERR, 'Tk::Text', $text); tie(*STDOUT, 'Tk::Text', $text); $SIG{'__WARN__'} = sub { print STDERR @_ };

You could also use the module Tie-STDERR. It has an option for:
use Tie::STDERR \$append_to_scalar;

good luck
Tie-bag
Sure there's more than one way, but one just needs one anyway - Teabag

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://291091]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2020-11-27 12:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?