STDOUT et al.

Joel Meulenberg joelmeulenberg at yahoo.com
Wed Jan 26 16:08:22 CST 2000


> This works.

On Win32 even!

Hey, BTW Jeff, a couple weeks ago I spent some time reading the Perl C
source code looking for a way to fix that problem I ran into (and you
researched) with the lexical var getting cleared out before the
continue block.  My bean still hurts from that!

I'll probably try to dive back into it one more time (when I feel like
I can stomach it) before sending the problem off to perlbug.

+Joel

--- Jeff Klein <jeffk at pcr7.pcr.com> wrote:
> This works.
> 
> use IO::File;
> $fh = IO::File->new_tmpfile();
> 
> open(SAVE, ">&STDOUT") or die $!;
> open(STDOUT, ">&${\fileno $fh}") or die $!;
> $| = 1;
> 
> print "This text is going nowhere...\n";
> print STDOUT "Neither is this...\n";
> 
> open(STDOUT, ">&SAVE");
> close(SAVE);
> print "STDOUT reopened.\n";
> 
> seek $fh, 0, 0;
> while (<$fh>) {
>    print;
> }
> 
> close $fh;

__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com



More information about the grand-rapids-pm-list mailing list