in reply to Porting Perl 5.6 to Perl 5.8 issue with self-tie
Well, a quick solution would be IO::Tee. This should be nearly a drop-in replacement. A more comprehensive solution would be Log::Log4perl.
I have no way to test this tonight, mayhapse another monk will correct me if wrong, but to assign an IO::Tee to, say, STDOUT would be done something like this:
local *STDOUT = new IO::Tee(\*STDOUT, '>file.txt');
UPDATE: No, after looking at that, I don't think that will work. This is more likely too, but there is probably a shorter way:
open STDOUT, '>&', new IO::Tee(\*STDOUT, '>file.txt');
With this method, you can do silly things like:
# Append open STDOUT, '>>&', new IO::Tee(\*STDOUT, '>file.txt'); # Save the extra file descriptor open STDOUT, '>&=', new IO::Tee(\*STDOUT, '>file.txt'); open STDOUT, '>>&=', new IO::Tee(\*STDOUT, '>file.txt');
See open for more details.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Porting Perl 5.6 to Perl 5.8 issue with self-tie
by fwashbur (Sexton) on Dec 11, 2006 at 22:30 UTC | |
by TedYoung (Deacon) on Dec 12, 2006 at 01:55 UTC | |
by fwashbur (Sexton) on Dec 12, 2006 at 17:13 UTC | |
by fwashbur (Sexton) on Dec 12, 2006 at 22:37 UTC |