Mail::Summary - scan read your mail!


Mail-Summary documentation Contained in the Mail-Summary distribution.

Index


Code Index:

NAME

Top

Mail::Summary - scan read your mail!

SYNOPSIS

Top

  my $ms = Mail::Summary->new({ maildir => '/home/mwk/Maildir' });

  my @mail_summaries = $ms->summaries;

DESCRIPTION

Top

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!

new

  my $ms = Mail::Summary->new({ maildir => '/home/mwk/Maildir' });

This will make a new Mail::Summary object.

maildir

  my $maildir = $ms->maildir;

This is the mail directory as defined by the user.

summaries

  my @mail_summaries = $ms->summaries;

This will return a list, with every entry in the list being a summary of an individual message.

BUGS

Top

I have only tried this with my Maildir style mailbox. If you use something else, and this works, I would love to hear from you. If it doesn't, I want to hear as well!

TODO

Top

Oh....lots of things.

  o Make it look more than the script it originally was!!
  o SMS the results of the summary?
  o Get the five keywords and feed them into google?
  o ignore already read messages
  o show which folder the messages summarised are in

SHOWING YOUR APPRECIATION

Top

There was a thread on london.pm mailing list about working in a vacumn - that it was a bit depressing to keep writing modules but never get any feedback. So, if you use and like this module then please send me an email and make my day.

All it takes is a few little bytes.

(Leon wrote that, not me!)

AUTHOR

Top

Stray Toaster <coder@stray-toaster.co.uk>

With Thanks

  o Dennis Taylor for his Lingua::EN::Summarize which inspired this!

COPYRIGHT

Top


Mail-Summary documentation Contained in the Mail-Summary distribution.
package Mail::Summary;

$Mail::Summary::VERSION = "0.02";

use strict;
use Mail::Box::Manager;
use Lingua::EN::Summarize;

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} }

sub maildir { shift->{maildir} }

sub _messages { shift->_mbm->messages }

sub summaries { map summarize($_->body), shift->_messages }

return qw/This is the secret message/;