Subject: | "Mail::Mbox::MessageParser::OLDSTDERR" used only once warning in 5.12.0 breaks grepmail |
When using Mail::Mbox::MessageParser with perl 5.12.0, the following
warning is emitted:
Name "Mail::Mbox::MessageParser::OLDSTDERR" used only once: possible
typo at
/path/to/Mail-Mbox-MessageParser-1.5002/blib/lib/Mail/Mbox/MessageParser.pm
line 297.
For example:
Solaris:
http://www.cpantesters.org/cpan/report/07193826-b19f-3f77-b713-d32bba55d77f
Windows:
http://www.cpantesters.org/cpan/report/07188256-b19f-3f77-b713-d32bba55d77f
NetBSD:
http://www.cpantesters.org/cpan/report/07222149-b19f-3f77-b713-d32bba55d77f
Moreover, this message can cause more severe problems in users of
Mail::Mbox::MessageParser, such as in grepmail's test suite, which is
broken as a result:
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'inc', 'blib/lib', 'blib/arch')" t/*.t
Name "Mail::Mbox::MessageParser::OLDSTDERR" used only once: possible
typo at /usr/share/perl5/Mail/Mbox/MessageParser.pm line 297.
# Failed test 't/temp/append_header_none.stderr compared to
t/results/none'
# at t/append_header.t line 98.
# Structures begin differing at:
# $got->[0] = 'Name "Mail::Mbox::MessageParser::OLDSTDERR" used
only once: possible typo at /usr/share/perl5/Mail/Mbox/MessageParser.pm
line 297.
# '
# $expected->[0] = Does not exist
# Failed test 't/temp/append_header_none.stderr compared to
t/results/none'
# at t/append_header.t line 98.
# Structures begin differing at:
# $got->[0] = 'Name "Mail::Mbox::MessageParser::OLDSTDERR" used
only once: possible typo at /usr/share/perl5/Mail/Mbox/MessageParser.pm
line 297.
# '
# $expected->[0] = Does not exist
# Failed test 't/temp/append_header_none.stderr compared to
t/results/none'
# at t/append_header.t line 98.
# Structures begin differing at:
# $got->[0] = 'Name "Mail::Mbox::MessageParser::OLDSTDERR" used
only once: possible typo at /usr/share/perl5/Mail/Mbox/MessageParser.pm
line 297.
# '
# $expected->[0] = Does not exist
# Failed test 't/temp/append_header_none.stderr compared to
t/results/none'
# at t/append_header.t line 98.
# Structures begin differing at:
# $got->[0] = 'Name "Mail::Mbox::MessageParser::OLDSTDERR" used
only once: possible typo at /usr/share/perl5/Mail/Mbox/MessageParser.pm
line 297.
# '
# $expected->[0] = Does not exist
# Failed test 't/temp/append_header_none.stderr compared to
t/results/none'
# at t/append_header.t line 98.
# Structures begin differing at:
# $got->[0] = 'Name "Mail::Mbox::MessageParser::OLDSTDERR" used
only once: possible typo at /usr/share/perl5/Mail/Mbox/MessageParser.pm
line 297.
# '
# $expected->[0] = Does not exist
# Looks like you failed 5 tests of 10.
t/append_header.t ...........
Dubious, test returned 5 (wstat 1280, 0x500)
Failed 5/10 subtests
Attached patch resolves the issue for me.
Subject: | Mail-Mbox-MessageParser-1.5002-warning.patch |
--- Mail-Mbox-MessageParser-1.5002/lib/Mail/Mbox/MessageParser.pm 2009-08-09 21:14:47.000000000 +0100
+++ Mail-Mbox-MessageParser-1.5002/lib/Mail/Mbox/MessageParser.pm 2010-06-01 21:28:41.820260814 +0100
@@ -293,8 +293,7 @@
dprint "Calling \"$filter_command\" to decompress file \"$file_name\".";
- use vars qw(*OLDSTDERR);
- open OLDSTDERR,">&STDERR" or die "Can't save STDERR: $!\n";
+ open my $OLDSTDERR,">&STDERR" or die "Can't save STDERR: $!\n";
open STDERR,">" . File::Spec->devnull()
or die "Can't redirect STDERR to " . File::Spec->devnull() . ": $!\n";
@@ -305,7 +304,7 @@
binmode $file_handle;
- open STDERR,">&OLDSTDERR" or die "Can't restore STDERR: $!\n";
+ open STDERR,">&", $OLDSTDERR or die "Can't restore STDERR: $!\n";
if (eof($file_handle))
{