On Sat Dec 29 04:29:43 2001, abeltje wrote: > write() on a tie()d filehandle complains about an unopened filehandle. > > The printf() on the that same tie()d filehandle works ok. > > I looked at the documentation but couldn't find any mention of write() > not beeing > supported. > > This program demonstrates it (confirmed for ActivePerl 5.6.1 build > 628). > > #!perl > use warnings FATAL => 'all'; > use strict; > > { > package FakeOut; > sub TIEHANDLE { bless \( my $scalar ), shift; } > sub PRINT { my $self = shift; $$self .= shift; } > sub PRINTF { > my $self = shift; > my $fmt = shift; > $$self .= sprintf $fmt, @_; > } > > } > > my( $text, $numb ); > format FAKEOUT = > @<<<<<<<<<< @>>>>> > $text, $numb > .. > > my $fake = tie *FAKEOUT, 'FakeOut'; > foreach $text ( qw( one two three four five ) ) { > $numb = length $text; > # printf FAKEOUT "%-10s %5s\n", $text, $numb; > write FAKEOUT; > } > > print $$fake; > > __END__ > > write() on unopened filehandle FAKEOUT at tiedwrite.pl line 27. > Is this a bug? Wouldn't you have to define a WRITE method for the tied handle for this to work? --hugmeir --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=8149Thread Previous | Thread Next