1Mail::Mbox::MessageParsUesre:r:GCroenpt(r3i)buted Perl DMoaciulm:e:nMtbaotxi:o:nMessageParser::Grep(3)
2
3
4
6 Mail::Mbox::MessageParser::Grep - A GNU grep-based mbox folder reader
7
9 #!/usr/bin/perl
10
11 use Mail::Mbox::MessageParser;
12
13 my $filename = 'mail/saved-mail';
14 my $filehandle = new FileHandle($filename);
15
16 my $folder_reader =
17 new Mail::Mbox::MessageParser( {
18 'file_name' => $filename,
19 'file_handle' => $filehandle,
20 'enable_grep' => 1,
21 } );
22
23 die $folder_reader unless ref $folder_reader;
24
25 # Any newlines or such before the start of the first email
26 my $prologue = $folder_reader->prologue;
27 print $prologue;
28
29 # This is the main loop. It's executed once for each email
30 while(!$folder_reader->end_of_file());
31 {
32 my $email = $folder_reader->read_next_email();
33 print $email;
34 }
35
37 This module implements a GNU grep-based mbox folder reader. It can only
38 be used when GNU grep is installed on the system. Users must not
39 instantiate this class directly--use Mail::Mbox::MessageParser instead.
40 The base MessageParser module will automatically manage the use of grep
41 and non-grep implementations.
42
43 METHODS AND FUNCTIONS
44
45 The following methods and functions are specific to the
46 Mail::Mbox::MessageParser::Grep package. For additional inherited ones,
47 see the Mail::Mbox::MessageParser documentation.
48
49 $ref = new( { 'file_name' => <mailbox file name>, 'file_handle' =>
50 <mailbox file handle> });
51 <file_name> - The full filename of the mailbox
52 <file_handle> - An opened file handle for the mailbox
53
54 The constructor for the class takes two parameters. The file_name
55 parameter is the filename of the mailbox. The file_handle argument
56 is the opened file handle to the mailbox.
57
58 Returns a reference to a Mail::Mbox::MessageParser object, or a
59 string describing the error.
60
62 No known bugs.
63
64 Contact david@coppit.org for bug reports and suggestions.
65
67 David Coppit <david@coppit.org>.
68
70 This software is distributed under the terms of the GPL. See the file
71 "LICENSE" for more information.
72
74 This code was originally part of the grepmail distribution. See
75 http://grepmail.sf.net/ for previous versions of grepmail which
76 included early versions of this code.
77
79 Mail::Mbox::MessageParser
80
81
82
83perl v5.8.8 2007-01-11Mail::Mbox::MessageParser::Grep(3)