use Symbol;
-print "1..38\n";
+print "1..40\n";
my $fh = gensym;
use warnings;
# Special case of aliasing STDERR, which used
# to dump core when warnings were enabled
- *STDERR = *$fh;
+ local *STDERR = *$fh;
@expect = (PRINT => $ob,"some","text");
$r = print STDERR @expect[2,3];
ok($r == 1);
sub TIEARRAY {bless {}}
}
+{
+ # warnings should pass to the PRINT method of tied STDERR
+ my @received;
+
+ local *STDERR = *$fh;
+ local *Implement::PRINT = sub { @received = @_ };
+
+ $r = warn("some", "text", "\n");
+ @expect = (PRINT => $ob,"sometext\n");
+
+ Implement::compare(PRINT => @received);
+}
+
+{
+ # [ID 20020713.001] chomp($data=<tied_fh>)
+ local *TEST;
+ tie *TEST, 'CHOMP';
+ my $data;
+ chomp($data = <TEST>);
+ ok($data eq 'foobar');
+
+ package CHOMP;
+ sub TIEHANDLE { bless {}, $_[0] }
+ sub READLINE { "foobar\n" }
+}