cadphile has asked for the wisdom of the Perl Monks concerning the following question:
(I need to use the $fileno because the ">&" dup operation doesn't work on I/O typeglobs.)use FileHandle; use Carp qw (cluck croak); my $LOG_FH = new FileHandle( "somefile", "w" ); my $fileno = fileno $LOG_FH; open STDERR, ">&$fileno" or croak "Can't dup STDERR."; cluck "Testing the output of Carp commands.";
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.
Any clues??
Thanks, -Cadphile
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: duplicating STDERR to a logfile...
by Kanji (Parson) on May 08, 2002 at 21:54 UTC | |
(RhetTbull) Re: duplicating STDERR to a logfile...
by RhetTbull (Curate) on May 09, 2002 at 02:03 UTC | |
by cadphile (Beadle) on May 17, 2002 at 00:50 UTC | |
Re: duplicating STDERR to a logfile...
by jsegal (Friar) on May 08, 2002 at 22:09 UTC | |
Re: duplicating STDERR to a logfile...
by belg4mit (Prior) on May 09, 2002 at 01:42 UTC |