GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mail::Mbox::MessageParser::Cache(3) User Contributed Perl Documentation Mail::Mbox::MessageParser::Cache(3)

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

  #!/usr/bin/perl

  use Mail::Mbox::MessageParser;

  my $filename = 'mail/saved-mail';
  my $filehandle = new FileHandle($filename);

  # Set up cache
  Mail::Mbox::MessageParser::SETUP_CACHE(
    { 'file_name' => '/tmp/cache' } );

  my $folder_reader =
    new Mail::Mbox::MessageParser( {
      'file_name' => $filename,
      'file_handle' => $filehandle,
      'enable_cache' => 1,
    } );

  die $folder_reader unless ref $folder_reader;
  
  warn "No cached information"
    if $Mail::Mbox::MessageParser::Cache::UPDATING_CACHE;

  # Any newlines or such before the start of the first email
  my $prologue = $folder_reader->prologue;
  print $prologue;

  # This is the main loop. It's executed once for each email
  while(!$folder_reader->end_of_file());
  {
    my $email = $folder_reader->read_next_email();
    print $email;
  }

This module implements a cached-based mbox folder reader. It can only be used when cache information already exists. Users must not instantiate this class directly--use Mail::Mbox::MessageParser instead. The base MessageParser module will automatically manage the use of cache and non-cache implementations.

The following methods and functions are specific to the Mail::Mbox::MessageParser::Cache package. For additional inherited ones, see the Mail::Mbox::MessageParser documentation.
$ref = new( { 'file_name' => <mailbox file name>, 'file_handle' => <mailbox file handle>, });
    <file_name> - The full filename of the mailbox
    <file_handle> - An opened file handle for the mailbox
    

The constructor for the class takes two parameters. file_name is the filename of the mailbox. This will be used as the cache key, so it's important that it fully defines the path to the mailbox. The file_handle argument is the opened file handle to the mailbox. Both arguments are required.

Returns a reference to a Mail::Mbox::MessageParser object, or a string describing the error.

reset()
read_next_email()
These methods are overridden in this subclass of Mail::Mbox::MessageParser.

No known bugs.

Contact david@coppit.org for bug reports and suggestions.

David Coppit <david@coppit.org>.

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

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

Mail::Mbox::MessageParser
2015-05-03 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.