NAME

Mail::Mbox::MessageParser::Grep - A GNU grep-based mbox folder reader

SYNOPSIS

#!/usr/bin/perl

use Mail::Mbox::MessageParser::Grep;

my $filename = 'mail/saved-mail';
my $filehandle = new FileHandle($filename);

my $folder_reader =
  new Mail::Mbox::MessageParser::Grep( {
    'file_name' => $filename,
    'file_handle' => $filehandle,
    'file_handle' => $filehandle,
  } );

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;
}

DESCRIPTION

This module implements a GNU grep-based mbox folder reader. It can only be used when GNU grep is installed on the system. Users are encouraged to use Mail::Mbox::MessageParser instead. The base MessageParser module will automatically fall back to another reader implementation if this module can not be used.

METHODS AND FUNCTIONS

The following methods and functions are specific to the Mail::Mbox::MessageParser::Grep package. For additional inherited ones, see the Mail::Mbox::MessageParser documentation.

$ref = new( { 'file_name' => <mailbox file name>, 'file_handle' => <mailbox file handle>, 'force_processing' => <1 or 0>, });
<file_name> - The full filename of the mailbox
<file_handle> - An opened file handle for the mailbox
<force_processing> - true to force processing of files that look invalid

The constructor for the class takes two parameters. file_name is the filename of the mailbox. The file_handle argument is the opened file handle to the mailbox. Both arguments are required.

Returns a reference to a Mail::Mbox::MessageParser object, or a string describing the error.

BUGS

No known bugs.

Contact david@coppit.org for bug reports and suggestions.

AUTHOR

David Coppit <david@coppit.org>.

LICENSE

This software is distributed under the terms of the GPL. See the file "LICENSE" for more information.

HISTORY

This 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 ALSO

Mail::Mbox::MessageParser

1 POD Error

The following errors were encountered while parsing the POD:

Around line 303:

You forgot a '=back' before '=head1'