Sisimai::Mail::Mbox(3pm)

Sisimai::Mail::Mbox3pm

Mailbox reader

Usage

    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
    }

Overview

"Sisimai::Mail::Mbox" is a mailbox file (UNIX mbox) reader.

Class methods

"new(path to mbox)"

new() method is a constructor of "Sisimai::Mail::Mbox"

    my $mailbox = Sisimai::Mail::Mbox->new('/var/mail/root');

Instance methods

"dir()"

dir() method returns the directory name of the UNIX mbox

    print $mailbox->dir;   # /var/mail

"path()"

path() meethod returns the path to the mbox.

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

"file()"

file() method returns the file name of the mbox.

    print $mailbox->file;   # root

"size()"

size() method returns the file size of the mbox.

    print $mailbox->size;   # 94515

"offset()"

offset() method returns the offset position for seeking the mbox. The value of "offset" is a bytes which have already read.

    print $mailbox->offset;   # 0

"handle()"

handle() method returns file handle object "IO::File" of the mbox.

    $mailbox->handle->close;

"read()"

read() method works as an 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
    }

Releases

4 releases since Debian 10 (Buster); the text changed 3 times.

  1. 10
  2. 11
  3. 12
  4. 13

Author

azumakuniyuki

License

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

From libsisimai-perl 5.3.0-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.