The stupid question is the question not asked | |
PerlMonks |
Re: Reset STDERR to consoleby sundialsvc4 (Abbot) |
on Apr 01, 2011 at 17:05 UTC ( [id://896954]=note: print w/replies, xml ) | Need Help?? |
I am not sure that you can read from STDERR while it is being written to, and of course if (say) it was being directed to a pipe or to /dev/null you couldn’t read it anyhow. So, what if we try this ... In a shell script or somesuch, invoke your Perl program, taking care to put STDERR specifically to somewhere you can capture it. Capture STDOUT, separately, in the same way. When the Perl program ends, the shell script now cats (or types) those two streams into its own (the shell script’s...) STDOUT and/or STDERR as appropriate. The shell script is now simply a “wrapper,” and the job is done. It could be very simple ... like this sketch of an idea:
No, “the job wasn’t done in the way” that you might now be considering, but ... “the job is done.” It’s clean, and obvious, and very easily changed. Win32 and Unix/Linux implementations of the same idea are equally trivial.
In Section
Seekers of Perl Wisdom
|
|