Tie::StdHandle appends extra copies of $\ to output
[perl #120202]
The following code demonstrates the problem:
use Tie::Handle;
my $out = do { no warnings 'once'; \ local *HANDLE };
tie *$out, 'Tie::StdHandle', '>&', \ *STDOUT or die;
$\ = "haha\n";
print $out "hihi\n";
which prints
hihi
haha
haha
The string in $\ has been added twice, once explicitly by
Tie::Handle::PRINT and another time implicitly by the use of
(CORE::) print in Tie::StdHandle::WRITE.
The bug also affects the use of say() with tied handles where a spurious
newline is added by the same effect.
[ test added by davem ]