laziness, impatience, and hubris | |
PerlMonks |
Redirecting STDOUT, lexically scopedby moritz (Cardinal) |
on Jul 31, 2007 at 09:33 UTC ( [id://629771]=perlquestion: print w/replies, xml ) | Need Help?? |
moritz has asked for the wisdom of the Perl Monks concerning the following question:
I read how do i redirect STDOUT, STDIN, or STDERR to a FILE?, and started to wonder if that can be done lexically scoped.
For some tasks it would be cool to redirect STDOUT to a file or to a scalar (with IO::Scalar), but only in certain scope. Of course local STDOUT dies with Can't modify constant item in local.... Is there a clean solution? Update: I just found IO::String and select which works for STDOUT, but is there a way for STDERR as well? I don't need it, I'm just curious ;-)
Back to
Seekers of Perl Wisdom
|
|