Mail::Folder::FastReader is my first foray into XS in order to speed up my grepmail script. It basically implements a sequential mailbox reader for mbox-style mailboxes. It looks for the start of an email, and avoids emails "included" in others. The goal of the module is speed, so I'm looking for any suggestions for making the C implementation faster. I guess I don't do a bit of locking, so there are probably safety issues. I'm also open to suggestions for features if they don't compromise the performance. You can download the package at http://www.coppit.org/code/Mail-Folder-FastReader-0.01.tar.gz Thanks, David ------------------------------------------------------------------------ NAME Mail::Folder::FastReader - A fast mailbox reader SYNOPSIS use Mail::Folder::FastReader qw( read_email reset_file ); open MAILBOX,"saved-mail"; reset_file(MAILBOX); while (1) { my ($status, $email, $line_number) = read_email(); last unless $status print <<EOF; EMAIL STARTING ON LINE $line_number: $email ------------------------------------- EOF } close MAILBOX; DESCRIPTION This module provides a simple and fast way to read unix- style mailboxes. It basically searches for the next line that begins with "From ", but which doesn't follow a "----- Begin Included Message -----". FUNCTIONS ($status,$email,$line) = read_email() Read the next email from the filehandle, storing the email in $email and the line number in $line. The status is 1 if successful, and 0 if not. reset_file(FILEHANDLE) Reset the internal line counter and the reference to the filehandle. Call this before calling read_email(). AUTHOR David Coppit <[EMAIL PROTECTED]> SEE ALSO grepmail, mail(1), printmail(1), Mail::Internet(3) Crocker, D. H., Standard for the Format of Arpa Internet Text Messages, RFC822.
