Subject: | study() on empty headers fails |
a study() of a header that is empty (i.e., exists in the mail header,
but has no content apart from the header name) results in spurious
warnings or even failure.
The attached mbox and small perl script demonstrate it. The output I
get here is:
1: to-test
2: Use of uninitialized value in print at /tmp/bla.pl line 12, <GEN1>
line 10.
3:
4:
5: to-test
6: Use of uninitialized value in print at /tmp/test.pl line 17, <GEN1>
line 10.
7: Use of uninitialized value in substitution (s///) at
/usr/share/perl5/Mail/Message/Field.pm line 453, <GEN1> line 10.
Use of uninitialized value in length at
/usr/share/perl5/Mail/Message/Field.pm line 454, <GEN1> line 10.
8: Died at /usr/share/perl5/Mail/Message/Field/Full.pm line 386, <GEN1>
line 10.
tests 1-4 test a get() on a normal mail header, a non-existing mail
header (returns undef, so that's ok), and two empty headers. This all
works correctly.
tests 5-8 run a study() on the same headers: the first one is ok, the
seconds one again return undef, so that's also ok. The third one
however results in spurious warnings but seems to correctly return an
empty string. The final one results in a failure an the program dying.
Is this a bug, or am I overlooking something?
Thanks,
bas.
Subject: | test.pl |
#!/usr/bin/perl
use strict;
use warnings;
use Mail::Box::Manager;
my $mgr = Mail::Box::Manager->new( access => 'r' );
my $f = $mgr->open( folder => "test.mbox" );
select STDERR;
print '1: ', $f->[0]->get("to"), "\n";
print '2: ', $f->[0]->get("no-such-header"), "\n";
print '3: ', $f->[0]->get("reply-to"), "\n";
print '4: ', $f->[0]->get("subject"), "\n";
print '5: ', $f->[0]->study("to"), "\n";
print '6: ', $f->[0]->study("no-such-header"), "\n";
print '7: ', $f->[0]->study("reply-to"), "\n";
print '8: ', $f->[0]->study("subject"), "\n";
Subject: | test.mbox |
Message body not shown because it is not plain text.