1Mail::Mbox::MessageParsUesre:r:CCaocnhter(i3b)uted PerlMDaoiclu:m:eMnbtoaxt:i:oMnessageParser::Cache(3)
2
3
4

NAME

6       Mail::Mbox::MessageParser::Cache - A cache-based mbox folder reader
7

SYNOPSIS

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         # Set up cache
17         Mail::Mbox::MessageParser::SETUP_CACHE(
18           { 'file_name' => '/tmp/cache' } );
19
20         my $folder_reader =
21           new Mail::Mbox::MessageParser( {
22             'file_name' => $filename,
23             'file_handle' => $filehandle,
24             'enable_cache' => 1,
25           } );
26
27         die $folder_reader unless ref $folder_reader;
28
29         warn "No cached information"
30           if $Mail::Mbox::MessageParser::Cache::UPDATING_CACHE;
31
32         # Any newlines or such before the start of the first email
33         my $prologue = $folder_reader->prologue;
34         print $prologue;
35
36         # This is the main loop. It's executed once for each email
37         while(!$folder_reader->end_of_file());
38         {
39           my $email = $folder_reader->read_next_email();
40           print $email;
41         }
42

DESCRIPTION

44       This module implements a cached-based mbox folder reader. It can only
45       be used when cache information already exists. Users must not
46       instantiate this class directly--use Mail::Mbox::MessageParser instead.
47       The base MessageParser module will automatically manage the use of
48       cache and non-cache implementations.
49
50   METHODS AND FUNCTIONS
51       The following methods and functions are specific to the
52       Mail::Mbox::MessageParser::Cache package. For additional inherited
53       ones, see the Mail::Mbox::MessageParser documentation.
54
55       $ref = new( { 'file_name' => <mailbox file name>, 'file_handle' =>
56       <mailbox file handle>, });
57               <file_name> - The full filename of the mailbox
58               <file_handle> - An opened file handle for the mailbox
59
60           The constructor for the class takes two parameters. file_name is
61           the filename of the mailbox. This will be used as the cache key, so
62           it's important that it fully defines the path to the mailbox. The
63           file_handle argument is the opened file handle to the mailbox. Both
64           arguments are required.
65
66           Returns a reference to a Mail::Mbox::MessageParser object, or a
67           string describing the error.
68
69       reset()
70       read_next_email()
71           These methods are overridden in this subclass of
72           Mail::Mbox::MessageParser.
73

BUGS

75       No known bugs.
76
77       Contact david@coppit.org for bug reports and suggestions.
78

AUTHOR

80       David Coppit <david@coppit.org>.
81

LICENSE

83       This code is distributed under the GNU General Public License (GPL)
84       Version 2.  See the file LICENSE in the distribution for details.
85

HISTORY

87       This code was originally part of the grepmail distribution. See
88       http://grepmail.sf.net/ for previous versions of grepmail which
89       included early versions of this code.
90

SEE ALSO

92       Mail::Mbox::MessageParser
93
94
95
96perl v5.32.0                      2020-07-28Mail::Mbox::MessageParser::Cache(3)
Impressum