use Symbol;
-print "1..35\n";
+print "1..39\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);
untie *STDIN;
}
+
+{
+ # test for change 11639: Can't localize *FH, then tie it
+ {
+ local *foo;
+ tie %foo, 'Blah';
+ }
+ ok(!tied %foo);
+
+ {
+ local *bar;
+ tie @bar, 'Blah';
+ }
+ ok(!tied @bar);
+
+ {
+ local *BAZ;
+ tie *BAZ, 'Blah';
+ }
+ ok(!tied *BAZ);
+
+ package Blah;
+
+ sub TIEHANDLE {bless {}}
+ sub TIEHASH {bless {}}
+ 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);
+}
+