Subject: | endless loop in Mail/Mbox/MessageParser/Perl.pm _read_rest_of_email() |
The attached example does not return from the first invokation of
read_next_email(). This is caused by an endless loop in
Mail/Mbox/MessageParser/Perl.pm _read_rest_of_email()
environment:
perl-5.8.8-76.2
openSUSE 10.3
Linux 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC i686 athlon
i386 GNU/Linux
Subject: | loop_2emails.t |
#!/usr/bin/perl -w
use Mail::Mbox::MessageParser;
my $mailbox = <<'EOF';
From a@example.com Thu Jul 05 08:29:17 2001
Subject: an example email from a@example.com
a
From a@example.com Thu Jul 05 08:43:16 2001
Subject: a
a
EOF
my $file_name = 'testbox_2emails';
open FH, '>', $file_name or die "can't open $file_name: $!";
print FH $mailbox or die "can't write $file_name: $!";
close FH or die "can't close $file_name: $!";
my $folder_reader =
new Mail::Mbox::MessageParser( {
'file_name' => $file_name,
'file_handle' => new FileHandle($file_name),
'enable_cache' => 0,
'enable_grep' => 0,
} );
die $folder_reader unless ref $folder_reader;
while(!$folder_reader->end_of_file())
{
print "doing read_next_email() ...\n";
my $email = $folder_reader->read_next_email();
print "email content: $$email\n";
}
print "reached end of while\n";
1;