Skip Menu |

This queue is for tickets about the Mail-Mbox-MessageParser CPAN distribution.

Report information
The Basics
Id: 11986
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Mail-Mbox-MessageParser

People
Owner: Nobody in particular
Requestors: bjacob [...] ca.metsci.com
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 1.3000
Fixed in: (no value)



Subject: module says there is only one email, but there are two
I attached an email folder with two emails in it. But when Mail::Mbox::MessageParser iterated through the emails in this folder, it has only one iteration. It should have two iterations since there are two emails. A different module called Mail::Box::Manager correctly says there are two emails, so you might consider looking at Mail::Box::Manager to get an idea of how to fix Mail::Mbox::MessageParser. I can't just switch to Mail::Box::Manager since I am using grepmail and grepmail uses Mail::Mbox::MessageParser. The attached email folder was made by the mail reader "VM" (http://www.wonderworks.com/vm/). The perl script at the end of this report demonstrates the bug. The script uses example code from the documentation of each module. I made only small changes to the examples. The script outputs: Mail::Mbox::MessageParser read an email. Mail::Box::Manager says there are 2 emails. But it should output: Mail::Mbox::MessageParser read an email. Mail::Mbox::MessageParser read an email. Mail::Box::Manager says there are 2 emails. "perl -v" says, "This is perl, v5.6.1 built for i386-linux". "uname -a" says, "Linux sumatra.ca.metsci.com 2.4.18-17.7.xsmp #1 SMP Tue Oct 8 12:37:04 EDT 2002 i686 unknown". Here are the versions of the perl modules: Show quoted text
cpan> i Mail::Mbox::MessageParser
Strange distribution name [Mail::Mbox::MessageParser] Module id = Mail::Mbox::MessageParser CPAN_USERID DCOPPIT (David Coppit <david@coppit.org>) CPAN_VERSION 1.3000 CPAN_FILE D/DC/DCOPPIT/Mail-Mbox-MessageParser-1.3000.tar.gz INST_FILE (not installed) Show quoted text
cpan> i Mail::Box::Manager
Strange distribution name [Mail::Box::Manager] Module id = Mail::Box::Manager CPAN_USERID MARKOV (Mark Overmeer <mark@overmeer.net>) CPAN_VERSION 2.060 CPAN_FILE M/MA/MARKOV/Mail-Box-2.060.tar.gz MANPAGE Mail::Box::Manager - manage a set of folders INST_FILE /usr/lib/perl5/site_perl/5.6.1/Mail/Box/Manager.pm INST_VERSION 2.060 #!/usr/bin/perl -w use strict; use warnings; use Mail::Mbox::MessageParser; my $file_name = 'folder'; my $file_handle = new FileHandle($file_name); # Set up cache. (Not necessary if enable_cache is false.) Mail::Mbox::MessageParser::SETUP_CACHE( { 'file_name' => '/tmp/cache' } ); my $folder_reader = new Mail::Mbox::MessageParser( { 'file_name' => $file_name, 'file_handle' => $file_handle, 'enable_cache' => 1, 'enable_grep' => 1, } ); die $folder_reader unless ref $folder_reader; # Any newlines or such before the start of the first email my $prologue = $folder_reader->prologue; print $prologue; # This is the main loop. It's executed once for each email while(!$folder_reader->end_of_file()) { my $email = $folder_reader->read_next_email(); print "Mail::Mbox::MessageParser read an email.\n"; } #################################################################### use Mail::Box::Manager; my $mgr = Mail::Box::Manager->new; my $folder = $mgr->open(folder => 'folder'); # Get the number of messages in scalar context. my $emails = $folder->messages; print "Mail::Box::Manager says there are $emails emails.\n";
Download folder
application/octet-stream 3.5k

Message body not shown because it is not plain text.

Works for me. Make sure you delete the old /tmp/cache created by the previous (buggy) version of the module. Let me know if that fixes the problem. Meanwhile I've added a todo to add module version information to the cache so that we can automatically invalidate it in situations like this. Thanks!
What does the following script produce? For me it produces: There were 2 emails Version: 1.3000 Version: 0.1621 David
#!/usr/bin/perl use Mail::Mbox::MessageParser; Mail::Mbox::MessageParser::SETUP_CACHE( { 'file_name' => '/tmp/cache' } ); my $folder_reader = new Mail::Mbox::MessageParser( { 'file_handle' => \*DATA, } ); die $folder_reader unless ref $folder_reader; my $number_of_emails = 0; # This is the main loop. It's executed once for each email while(!$folder_reader->end_of_file()) { $number_of_emails++; $folder_reader->read_next_email(); 'enable_cache' => 1, 'enable_grep' => 1, } print "There were $number_of_emails emails\n"; print "Version: $Mail::Mbox::MessageParser::VERSION\n"; print "Version: $FileHandle::Unget::VERSION\n"; __DATA__ From bjacob Tue Nov 30 12:25:58 2004 X-VM-Message-Order: (1 2) X-VM-Summary-Format: "%n %*%a %-17.17F %-3.3m %2d %4l/%-5c %I\"%s\"\n" X-VM-Labels: nil X-VM-VHeader: ("Resent-" "From:" "Sender:" "To:" "Apparently-To:" "Cc:" "Subject:" "Date:") nil X-VM-Last-Modified: (16960 47449 943790) X-VM-IMAP-Retrieved: nil X-VM-POP-Retrieved: nil X-VM-Bookmark: 2 X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] [nil nil nil nil nil nil nil "Jacob Burckhardt" "bjacob@ca.metsci.com" nil nil nil "^From:" nil nil nil nil nil nil nil nil nil nil nil nil] nil) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16812.55126.466907.696629@sumatra.ca.metsci.com> X-Mailer: VM 6.96 under 21.1 (patch 12) "Channel Islands" XEmacs Lucid From: Jacob Burckhardt <bjacob@ca.metsci.com> To: Metron San Diego SysAdmins <sdis@ca.metsci.com> Subject: please change form at speedes.com Date: Tue, 30 Nov 2004 12:25:58 -0800 Please make the last three questions on this form be required information. If the user does not select yes or no, please make it pop up an error message saying it is required to be answered. http://www.speedes.com/registerdownload.html From bjacob Mon Mar 21 16:46:12 -0800 2005 X-VM-v5-Data: ([nil nil nil nil nil nil nil nil nil] [nil nil nil nil nil nil nil "Jacob Burckhardt" "bjacob@ca.metsci.com" nil nil nil "^From:" nil nil nil nil nil nil nil nil nil nil nil nil] nil) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <16959.27348.637863.456723@sumatra.ca.metsci.com> X-Mailer: VM 7.19 under 21.4 (patch 15) "Security Through Obscurity" XEmacs Lucid From: Jacob Burckhardt <bjacob@ca.metsci.com> To: Gary Blank <gblank@nethere.net> Subject: medical labs in our health insurance network Date: Mon, 21 Mar 2005 16:46:12 -0800 Aetna's web site says this lab is in Aetna's network: Group Name: Labcorp of America Holdings Type of Service: Independent Lab Address: 310 Santa Fe Drive, Suite 104, Encinitas, CA 92024 Phone Number(s): (760) 753-9359 This is the same building as Dr. Kim. I called Labcorp and asked if that suite number is correct and they said yes. They told me there is a different lab called Scripps lab on the third floor. I did not see Scripps lab in Aetna's network. I used to go to Scripps lab. It looks like I will have to switch to Labcorp. In case you have not already gone to any of the labs, I wanted to pass along this advice that Labcorp is probably the better choice. In case you have already gone, I wanted to know which one you went to and whether Aetna paid the claim with in-network benefits.
Glad I could help.