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
61 No known bugs.
62
63 Contact david@coppit.org for bug reports and suggestions.
64
66 David Coppit <david@coppit.org>.
67
69 This software is distributed under the terms of the GPL. See the file
70 "LICENSE" for more information.
71
73 This code was originally part of the grepmail distribution. See
74 http://grepmail.sf.net/ for previous versions of grepmail which
75 included early versions of this code.
76
78 Mail::Mbox::MessageParser
79
80
81
82perl v5.12.0 2009-08-09Mail::Mbox::MessageParser::Grep(3)