|
NAMEMail::Mbox::MessageParser - A fast and simple mbox folder readerSYNOPSIS#!/usr/bin/perl use Mail::Mbox::MessageParser; # Compression support my $file_name = 'mail/saved-mail.xz'; 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 $$email; } DESCRIPTIONThis module implements a fast but simple mbox folder reader. One of three implementations (Cache, Grep, Perl) will be used depending on the wishes of the user and the system configuration. The first implementation is a cached-based one which stores email information about mailboxes on the file system. Subsequent accesses will be faster because no analysis of the mailbox will be needed. The second implementation is one based on GNU grep, and is significantly faster than the Perl version for mailboxes which contain very large (10MB) emails. The final implementation is a fast Perl-based one which should always be applicable.The Cache implementation is about 6 times faster than the standard Perl implementation. The Grep implementation is about 4 times faster than the standard Perl implementation. If you have GNU grep, it's best to enable both the Cache and Grep implementations. If the cache information is available, you'll get very fast speeds. Otherwise, you'll take about a 1/3 performance hit when the Grep version is used instead. The overriding requirement for this module is speed. If you wish more sophisticated parsing, use Mail::MboxParser (which is based on this module) or Mail::Box. METHODS AND FUNCTIONS
BUGSNo known bugs.Contact david@coppit.org for bug reports and suggestions. AUTHORDavid Coppit <david@coppit.org>.LICENSEThis code is distributed under the GNU General Public License (GPL) Version 2. See the file LICENSE in the distribution for details.HISTORYThis code was originally part of the grepmail distribution. See http://grepmail.sf.net/ for previous versions of grepmail which included early versions of this code.SEE ALSOMail::MboxParser, Mail::Box
Visit the GSP FreeBSD Man Page Interface. |