develooper Front page | perl.perl5.porters | Postings from June 2011

[perl #8965] Tie'd STDIN overwritten by open F, "<-"

Thread Previous | Thread Next
Alexandr Ciornii via RT
June 16, 2011 16:47
[perl #8965] Tie'd STDIN overwritten by open F, "<-"
Message ID:

On Sat Apr 20 09:32:11 2002, wrote:

> it looks like a tie()d STDIN filehandle gets overwritten if you call
> open(FOO, "<-") and use FOO from then on. Somehow it reverts back to
> the original STDIN instead of using the tie()d one.

This program:
use 5.010;
use IO::Handle;
say \*STDIN;
open FOO, "<-";
say \*FOO;

shows that STDIN and FOO are 2 different Perl objects.
I suppose 'open FOO, "<-"' means 'open FOO, "<&=STDIN"', this means
different Perl filehandle for same OS filehandles and tie works only on
Perl filehandles.

Alexandr Ciornii,

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About