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 The following methods and functions are specific to the
45 Mail::Mbox::MessageParser::Grep package. For additional inherited ones,
46 see the Mail::Mbox::MessageParser documentation.
47
48 $ref = new( { 'file_name' => <mailbox file name>, 'file_handle' =>
49 <mailbox file handle> });
50 <file_name> - The full filename of the mailbox
51 <file_handle> - An opened file handle for the mailbox
52
53 The constructor for the class takes two parameters. The file_name
54 parameter is the filename of the mailbox. The file_handle argument
55 is the opened file handle to the mailbox.
56
57 Returns a reference to a Mail::Mbox::MessageParser object, or a
58 string describing the error.
59
60 end_of_file()
61 reset()
62 read_next_email()
63 These methods are overridden in this subclass of
64 Mail::Mbox::MessageParser.
65
67 No known bugs.
68
69 Contact david@coppit.org for bug reports and suggestions.
70
72 David Coppit <david@coppit.org>.
73
75 This code is distributed under the GNU General Public License (GPL)
76 Version 2. See the file LICENSE in the distribution for details.
77
79 This code was originally part of the grepmail distribution. See
80 http://grepmail.sf.net/ for previous versions of grepmail which
81 included early versions of this code.
82
84 Mail::Mbox::MessageParser
85
86
87
88perl v5.34.0 2022-01-21Mail::Mbox::MessageParser::Grep(3)