in reply to Re: (tye)Re: Local tied FILEHANDLE
in thread Local tied FILEHANDLE

If it isn't could someone explain the following short program to me? My expectation is that after calling local the original handle should be untouched by anything that you do. This emphatically is not happening:
test(1); test(2); sub test { my $iter = shift; my $fh = \*STDOUT; print $fh "Before local $iter\n"; local *STDOUT; print $fh "Before tying $iter\n"; tie (*STDOUT, 'Foo', $iter); print $fh "After tying $iter\n"; } package Foo; sub TIEHANDLE { my ($class) = shift; return bless([shift],$class); } sub PRINT { my ($self) = shift; print STDERR ("Foo::PRINT (tie $self->[0]): ",@_); }