Subject: | binmode STDOUT crashes Test::Output 0.13 |
Date: | Tue, 05 May 2009 19:04:20 +0200 |
To: | bug-test-output [...] rt.cpan.org |
From: | Alexander Foken <alexander [...] foken.de> |
Hello,
while running some tests for a CGI application that may deliver binary
content, I discovered that Test::Output 0.13 crashes when the writer
coderef calls binmode(STDOUT):
Show quoted text
> Can't locate object method "BINMODE" via package "Test::Output::Tie"
Test script is attached.
Simple solution: Add an empty sub BINMODE to Test::Output::Tie
sub BINMODE { }
Tested on Strawberry Perl v5.10.0 built for MSWin32-x86-multi-thread,
and on perl v5.8.8 built for i486-linux-thread-multi (Slackware 12.1).
Regards,
Alexander
#!/usr/bin/perl -w
use strict;
use Test::More tests => 2;
use Test::Output;
# The following test works ok
stdout_is(
sub {
print 'bla';
},
'bla'
);
# The following test crashes with
# <<Can't locate object method "BINMODE" via package "Test::Output::Tie">>
stdout_is(
sub {
binmode STDOUT;
print 'bla';
},
'bla'
);