NAME

Sisimai::Mail - Handler of Mbox/Maildir for reading each mail.

SYNOPSIS

use Sisimai::Mail;
my $mailbox = Sisimai::Mail->new('/var/mail/root');
while( my $r = $mailbox->read ) {
    print $r;
}

my $maildir = Sisimai::Mail->new('/home/neko/Maildir/cur');
while( my $r = $maildir->read ) {
    print $r;
}

DESCRIPTION

Sisimai::Mail is a handler of UNIX mbox or Maildir for reading each mail. It is wrapper class of Sisimai::Mail::Mbox and Sisimai::Mail::Maildir classes.

CLASS METHODS

new( path to mbox|Maildir/ )

new() is a constructor of Sisimai::Mail

my $mailbox = Sisimai::Mail->new('/var/mail/root');
my $maildir = Sisimai::Mail->new('/home/nyaa/Maildir/cur');

INSTANCE METHODS

path()

path() returns the path to mbox or Maildir.

print $mailbox->path;   # /var/mail/root

mbox()

mbox() returns 1 if the value of "path" is a file

print $mailbox->mbox;   # 1

mail()

mail() returns Sisimai::Mail::Mbox object or Sisimai::Mail::Maildir object.

my $o = $mailbox->mail;
print ref $o;   # Sisimai::Mail::Mbox

read()

read() works as a iterator for reading each email in mbox or Maildir. It calls Sisimai::Mail::Mbox->read or Sisimai::Mail::Maildir->read method.

my $mailbox = Sisimai::Mail->new('/var/mail/neko');
while( my $r = $mailbox->read ) {
    print $r;   # print each email in /var/mail/neko
}

AUTHOR

azumakuniyuki

COPYRIGHT

Copyright (C) 2014 azumakuniyuki <perl.org@azumakuniyuki.org>, All Rights Reserved.

LICENSE

This software is distributed under The BSD 2-Clause License.