1Mail::Mbox::MessageParsUesre:r:PCeornlt(r3i)buted Perl DMoaciulm:e:nMtbaotxi:o:nMessageParser::Perl(3)
2
3
4
6 Mail::Mbox::MessageParser::Perl - A Perl-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 } );
21
22 die $folder_reader unless ref $folder_reader;
23
24 # Any newlines or such before the start of the first email
25 my $prologue = $folder_reader->prologue;
26 print $prologue;
27
28 # This is the main loop. It's executed once for each email
29 while(!$folder_reader->end_of_file());
30 {
31 my $email = $folder_reader->read_next_email();
32 print $$email;
33 }
34
36 This module implements a Perl-based mbox folder reader. Users must not
37 instantiate this class directly--use Mail::Mbox::MessageParser instead.
38 The base MessageParser module will automatically manage the use of
39 faster implementations if they can be used.
40
41 METHODS AND FUNCTIONS
42 The following methods and functions are specific to the
43 Mail::Mbox::MessageParser::Perl package. For additional inherited ones,
44 see the Mail::Mbox::MessageParser documentation.
45
46 $ref = new( { 'file_name' => <mailbox file name>, 'file_handle' =>
47 <mailbox file handle> });
48 <file_name> - The full filename of the mailbox
49 <file_handle> - An opened file handle for the mailbox
50
51 The constructor for the class takes two parameters. The optional
52 file_name parameter is the filename of the mailbox. The required
53 file_handle argument is the opened file handle to the mailbox.
54
55 Returns a reference to a Mail::Mbox::MessageParser object, or a
56 string describing the error.
57
58 end_of_file()
59 reset()
60 read_next_email()
61 These methods are overridden in this subclass of
62 Mail::Mbox::MessageParser.
63
65 No known bugs.
66
67 Contact david@coppit.org for bug reports and suggestions.
68
70 David Coppit <david@coppit.org>.
71
73 This code is distributed under the GNU General Public License (GPL)
74 Version 2. See the file LICENSE in the distribution for details.
75
77 This code was originally part of the grepmail distribution. See
78 http://grepmail.sf.net/ for previous versions of grepmail which
79 included early versions of this code.
80
82 Mail::Mbox::MessageParser
83
84
85
86perl v5.30.0 2019-07-26Mail::Mbox::MessageParser::Perl(3)