Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

3Re: Best Way to Redirect STDERR to a Scalar

by jeffa (Chancellor)
on Sep 14, 2003 at 08:10 UTC ( #291361=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Best Way to Redirect STDERR to a Scalar
in thread Best Way to Redirect STDERR to a Scalar

I am curious to see if the following works for you or not:

use strict; use warnings; use IO::Scalar; my $str; my $err = tie *STDERR, 'IO::Scalar', \$str; print STDERR "captured\n"; undef $err; untie *STDERR; print STDERR "not captured\n";
UPDATE:
whoops, this is exactly what shenme already said. My apologies.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
B--B--B--B--B--B--B--B--
H---H---H---H---H---H---
(the triplet paradiddle with high-hat)


Comment on 3Re: Best Way to Redirect STDERR to a Scalar
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2015-07-04 01:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls