duplicating STDERR to a logfile...by cadphile (Beadle)
|on May 08, 2002 at 21:52 UTC||Need Help??|
cadphile has asked for the wisdom of the Perl Monks concerning the following question:
A simple question really: I want to capture the STDERR from commands like croak and cluck into a log file that records all output of my program. I've read the previous comments in Perl Monks and I find the following in the Camel book:
(I need to use the $fileno because the ">&" dup operation doesn't work on I/O typeglobs.)
This works fine: all STDERR after this goes into $LOG_FH, but it no longer goes to the terminal.
But what I want is like the command "tee". I want STDERR to go to the terminal window, AND to be duplicated into the $LOG_FH filehandle.