Mail-Summary
view release on metacpan or search on metacpan
package Mail::Summary;
$Mail::Summary::VERSION = "0.02";
=head1 NAME
Mail::Summary - scan read your mail!
=head1 SYNOPSIS
my $ms = Mail::Summary->new({ maildir => '/home/mwk/Maildir' });
my @mail_summaries = $ms->summaries;
=head1 DESCRIPTION
Too busy to read your mail? Subscribe to too many mailing lists?
Take two folders into the shower? Well, for the busy on the go geek
of today, here is the answer! Get all your messages summarised, to
save you having to read them, or to read them by which summary looks
better!
=cut
use strict;
use Mail::Box::Manager;
use Lingua::EN::Summarize;
=head2 new
my $ms = Mail::Summary->new({ maildir => '/home/mwk/Maildir' });
This will make a new Mail::Summary object.
=cut
sub new {
my $self = {};
bless $self, shift;
return $self->_init(@_);
}
sub _init {
my ($self, $ref) = @_;
die "No args passed to new" unless $ref;
die "Args to new not a hashref" unless ref $ref eq 'HASH';
die "No mail folder given" unless $ref->{maildir};
$self->{maildir} = $ref->{maildir};
$self->{mbm} = Mail::Box::Manager->new->open(folder => $ref->{maildir});
return $self;
}
sub _mbm { shift->{mbm} }
=head2 maildir
my $maildir = $ms->maildir;
This is the mail directory as defined by the user.
=cut
sub maildir { shift->{maildir} }
=head2 summaries
my @mail_summaries = $ms->summaries;
This will return a list, with every entry in the list being a summary of an
individual message.
=cut
sub _messages { shift->_mbm->messages }
sub summaries { map summarize($_->body), shift->_messages }
=head1 BUGS
( run in 2.923 seconds using v1.01-cache-2.11-cpan-0bb4e1dffa6 )