-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 59eda18
Showing
21 changed files
with
9,153 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
|
||
package Mail::Box::Tie; | ||
|
||
use strict; | ||
use v5.6.0; | ||
|
||
our $VERSION = '0.1'; | ||
|
||
=head1 NAME | ||
Mail::Box::Tie - Acces an existing message-folder as array | ||
=head1 SYNOPSIS | ||
tie my @inbox, 'Mail::Box::File', file => $ENV{MAIL}; | ||
tie my @inbox, $folder; | ||
foreach (@inbox) {print $_->short} | ||
print $inbox[3]; | ||
push @inbox, Mail::Box::Message->new(...); | ||
my $folder = tied @inbox; | ||
=head1 DESCRIPTION | ||
Read Mail::Box::Manager first. | ||
Folder certainly look as arrays, so why not just access them as one. Each | ||
folder is a sub-class of this class. | ||
=head1 PUBLIC INTERFACE | ||
Not all operations on arrays are supported. Actually, most functions which | ||
would reduce the size of the array are modified to signal messages as | ||
ready for removal. | ||
Examples of what you I<can> do: | ||
tie my @inbox, 'Mail::Box::File', ...; | ||
my $message = new Mail::Box::Message(...); | ||
push @inbox, $message; | ||
delete $inbox[2]; # becomes undef | ||
$inbox[3] = $message; | ||
print $inbox[0]->status; | ||
my $emails = @inbox; | ||
untie @inbox; # calls write() | ||
# Direct access to the Mail::Box object. | ||
my $folder = tied @inbox; | ||
$folder->synchonize; | ||
Examples what you I<cannot> do: | ||
shift/unshift/pop/splice @inbox; | ||
=over 4 | ||
=cut | ||
|
||
#------------------------------------------- | ||
|
||
=item tie ARRAY, FOLDERTYPE, PARAMS | ||
=item tie ARRAY, FOLDERTYPE, FOLDER | ||
There are to ways to construct a tie. In the first case, you start with | ||
a tie, and may later ask for the tied folder structure. In the second | ||
version, you have first created a folder, and then put a tie around it. | ||
The first version: tie an ARRAY to a folder of type FOLDERTYPE, where | ||
the constructor of the folder requires some parameters. Possible PARAMS | ||
are the parameters of the C<new> constructor of the specified folder-type. | ||
Example: | ||
tie my(@inbox), 'Mail::Box::File', folder => $ENV{MAIL}; | ||
my $inbox = tied @inbox; | ||
The second version: tie an ARRAY interface around an existing FOLDER. The | ||
type as specified with FOLDERTYPE is only used to find the correct | ||
TIEARRAY method, usually the result of C<ref FOLDER>. | ||
Example: | ||
my $inbox = Mail::Box::File->new(folder => $ENV{MAIL}); | ||
tie my(@inbox), ref $inbox, $inbox; | ||
=cut | ||
|
||
sub TIEARRAY(@) | ||
{ my $class = shift; | ||
return shift if ref $_[0] && $_[0]->isa('Mail::Box'); | ||
$class->new(@_); | ||
} | ||
|
||
sub FETCH($) { shift->activeMessage(@_) } | ||
|
||
sub STORE($$) | ||
{ my Mail::Box $self = shift; | ||
my $index = shift; | ||
$self->activeMessage($index) = shift; | ||
} | ||
|
||
sub FETCHSIZE() { scalar shift->messages } | ||
|
||
sub PUSH(@) | ||
{ my Mail::Box $self = shift; | ||
$self->addMessages(@_); | ||
scalar $self->messages; | ||
} | ||
|
||
sub DELETE($) { shift->activeMessage(shift)->delete } | ||
|
||
# DESTROY is implemented in Mail::Box | ||
#------------------------------------------- | ||
|
||
=back | ||
=head2 IMPLEMENTED METHODS | ||
This module implements C<TIEARRAY>, C<FETCH>, C<STORE>, C<FETCHSIZE>, | ||
C<DELETE>, C<PUSH>, and C<DESTROY>. | ||
This module does not implement all other methods as described in | ||
the L<Tie::Array> manual-page. | ||
=head1 AUTHOR | ||
Mark Overmeer (F<Mark@Overmeer.net>). | ||
All rights reserved. This program is free software; you can redistribute | ||
it and/or modify it under the same terms as Perl itself. | ||
=head1 VERSION | ||
This code is beta, version 0.1 | ||
=cut | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
CHANGELOG of Mail::Box | ||
|
||
version 0.1: Sat Dec 9 20:38:40 CET 2000 | ||
|
||
Mark Overmeer <mark@overmeer.net> | ||
* Initial coding of | ||
AT/Folder.pm | ||
AT/Folder/Locker.pm | ||
AT/Folder/Manager.pm | ||
AT/Folder/Mbox.pm | ||
AT/Folder/Message.pm | ||
AT/Folder/Threads.pm | ||
AT/Folder/Tie.pm | ||
(including some tests) | ||
|
||
version 0.2: | ||
|
||
Mark Overmeer <mark@overmeer.net> | ||
* Improvements on Threads | ||
AT/Folder/Threads.pm | ||
|
||
* Mail::Box->new(take_headers => ...) | ||
now documents that you can use regular-expressions and accepts | ||
'ALL' and 'REAL'. New option realhead_type to indicate which | ||
type of header is used by MIME::Entity. | ||
AT/Folder.pm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
t/1mh1w.t | ||
t/2mbox1r.t | ||
t/2mbox2w.t | ||
t/2mbox3d.t | ||
t/7mgr.t | ||
t/8tie.t | ||
t/9lock.t | ||
t/mbox.src | ||
Box/Locker.pm | ||
Box/Manager.pm | ||
Box/Mbox.pm | ||
Box/Message.pm | ||
Box/MH.pm | ||
Box.pm | ||
Box/Threads.pm | ||
Box/Tie.pm | ||
ChangeLog | ||
Makefile.PL | ||
MANIFEST | ||
README | ||
TODO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use ExtUtils::MakeMaker; | ||
# See lib/ExtUtils/MakeMaker.pm for details of how to influence | ||
# the contents of the Makefile that is written. | ||
|
||
WriteMakefile( | ||
NAME => 'Mail::Box', | ||
VERSION_FROM => 'Box.pm', # finds $VERSION | ||
PREREQ_PM => { Mail::Internet => 1.33 | ||
, MIME::Tools => 5.406 | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
README Mail::Box | ||
|
||
|
||
The Mail::Box folder is a modern mail-folder manager (at least on | ||
the moment of this writing) It is written to replace Mail::Folder, | ||
although it interface is different. | ||
|
||
===== Features | ||
|
||
Although the implementation of Mail::Box is young, it has already | ||
a large number of features. BE WARNED: NOT EVERYTHING WHAT IS | ||
IMPLEMENTED HAS BEEN TESTED!!!! PLEASE HELP TESTING! | ||
|
||
= AUTOLOAD messages. | ||
|
||
Everyone who has used MIME::Entity will agree that this object is | ||
slow: detailed parsing of e-mail messages by MIME::Entity is twice | ||
as slow as the sloppy work of Mail::Internet (where it is based on). | ||
|
||
The Mail::Box folders are trying to keep the messages stored in the | ||
mailbox file(s) for as long as possible. Only if the user of the | ||
folder really needs the content of the message, it is read from | ||
file and parsed. | ||
|
||
Demand-parsing/delayed parsing of messages is implemented using | ||
the standard AUTOLOAD mechanism, which means that it is not visible | ||
to the users of the folder! This mechanism also reduces the memory | ||
foot-print of the program enormously. | ||
|
||
A few (or all) header-lines are available, even when a message is | ||
not parsed, to try to avoid autoloading as much as possible. For | ||
instance the `Subject'-line is taken, because it is nearly always | ||
needed. | ||
|
||
*** more to follow | ||
|
||
===== Differences with Mail::Folder | ||
|
||
The popular Mail::Folder package is around for many years. It is | ||
written using Mail::Internet, instead of the more powerful | ||
MIME::Entity messages. | ||
|
||
An other large difference, is that the objects in Mail::Folder are | ||
less clear than in Mail::Box. The supported mail-box types are | ||
seperately implemented, and share less code than they could. | ||
The folders manage themselves instead of a seperate folder-manager | ||
object. | ||
|
||
Mail::Folder does not support discussion thread detection, nor | ||
autoloading of message data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
This program was written in December 2000. This is quite recent, so | ||
please check for a new version: new programs often get many changes | ||
in their first months. | ||
|
||
The most important parts of the module were tested (see the test-scripts) | ||
but quite some things didn't get tested yet. Please contribute with | ||
tests and fixed, were needed. Even the tested parts, however, may still | ||
contain problems, because the number of tests is limited. | ||
|
||
TO BE TESTED (and improved): | ||
thread discovery | ||
file-lock | ||
nfs-lock | ||
sub-folders | ||
delete folders | ||
|
||
TO BE IMPLEMENTED: | ||
Thread lint | ||
extracting large message-parts into persistent external files | ||
|
Oops, something went wrong.