Kevin Johnson > MailFolder-0.07 > Mail::Folder::Emaul

Download:
MailFolder-0.07.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  3
Open  0
View Bugs
Report a bug
Module Version: 0.07   Source  

NAME ^

Mail::Folder::Emaul - An Emaul folder interface for Mail::Folder.

WARNING: This code is in alpha release. Expect the interface to change.

SYNOPSIS ^

use Mail::Folder::Emaul;

DESCRIPTION ^

This module provides an interface to the emaul folder mechanism. It is currently intended to be used as an example of hooking a folder interface into Mail::Folder.

The folder structure of Emaul is styled after mh. It uses directories for folders and numerically-named files for the individual mail messages. The current message for a particular folder is stored in a file .current_msg in the folder directory.

Folder locking is accomplished through the use of a .lock file in the folder directory.

If a Timeout option is specified when the object is created, that value will be used to determine the timeout for attempting to aquire a folder lock. The default is 10 seconds.

METHODS ^

open($folder_name)

Populates the Mail::Folder object with information about the folder.

sync

Flushes any pending changes out to the original folder.

pack

Calls the superclass pack method.

Return 0 if the folder is readonly.

Return 0 if the folder cannot be locked.

Renames the message files in the folder so that there are no gaps in the numbering sequence. It will tweak current_message accordingly.

Old deleted message files (ones that start with ,) are also renamed as necessary.

It will abandon the operation and return 0 if a rename fails, otherwise it returns 1.

Please note that pack acts on the real folder.

get_message($msg_number)

Calls the superclass get_message method.

Retrieves the given mail message file into a Mail::Internet object reference and returns the reference.

It will coerce the From_ field into a Mail-From field, add the 'seen' label to the message, remove the Content-Length field if present, and cache the header.

Returns undef on failure.

get_message_file($msg_number)

Calls the superclass get_message_file method.

Retrieves the given mail message file and returns the name of the file.

Returns undef on failure.

get_header($msg_number)

Calls the superclass get_header method.

If the particular header has never been retrieved then get_header loads the header of the given mail message into a member of $self->{Messages}{$msg_number} and returns the object reference

If the header for the given mail message has already been retrieved in a prior call to get_header, then the cached entry is returned.

The Content-Length field is deleted from the header object it returns.

append_message($mref)

Calls the superclass append_message method.

Returns 0 if it cannot lock the folder.

Appends the contents of the mail message contained $mref to the the folder.

It also caches the header.

Please note that, contrary to other documentation for Mail::Folder, the Emaul append_message method actually updates the real folder, rather than queueing it up for a subsequent sync. The dup and refile methods are also affected. This will be fixed soon.

update_message($msg_number, $mref)

Calls the superclass update_message method.

It returns 0 if it cannot lock the folder.

Replaces the message pointed to by $msg_number with the contents of the Mail::Internet object reference $mref.

Please note that, contrary to other documentation for Mail::Folder, the Emaul update_message method actually updates the real folder, rather than queueing it up for a subsequent sync. This will be fixed soon.

is_valid_folder_format($foldername)

Returns 0 if the folder is not a directory or looks like a maildir folder. The current logic allows it to handle MH directories, but watch out; you should probably set the NotMUA option so the interface doesn't create it's own little folder droppings like .msg_labels and such.

create($foldername)

Returns 0 if the folder already exists.

Creates a new folder named $foldername with mode 0700 and then returns 1.

AUTHOR ^

Kevin Johnson <kjj@pobox.com>

COPYRIGHT ^

Copyright (c) 1996-1998 Kevin Johnson <kjj@pobox.com>.

All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.