NAME
Sisimai::Mail::Mbox - Mailbox reader
SYNOPSIS
use Sisimai::Mail::Mbox;
my $mailbox = Sisimai::Mail::Mbox->new('/var/spool/mail/root');
while( my $r = $mailbox->read ) {
print $r; # print contents of each mail in mbox
}
DESCRIPTION
Sisimai::Mail::Mbox is a mailbox file (UNIX mbox) reader.
CLASS METHODS
new( path to mbox )
new()
is a constructor of Sisimai::Mail::Mbox
my $mailbox = Sisimai::Mail::Mbox->new('/var/mail/root');
INSTANCE METHODS
data()
data()
returns the path to mbox.
print $mailbox->data; # /var/mail/root
name()
name()
returns a file name of the mbox.
print $mailbox->name; # root
size()
size()
returns the file size of the mbox.
print $mailbox->size; # 94515
offset()
offset()
returns offset position for seeking the mbox. The value of "offset" is bytes which have already read.
print $mailbox->offset; # 0
handle()
handle()
returns file handle object (IO::File) of the mbox.
$mailbox->handle->close;
read()
read()
works as a iterator for reading each email in the mbox.
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.