The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Sisimai::Mail::Maildir - Mailbox reader

SYNOPSIS

    use Sisimai::Mail::Maildir;
    my $maildir = Sisimai::Mail::Maildir->new('/home/neko/Maildir/new');
    while( my $r = $maildir->read ) {
        print $r;   # print contents of the mail in the Maildir/
    }

DESCRIPTION

Sisimai::Mail::Maildir is a reader for getting contents of each email in the Maildir/ directory.

CLASS METHODS

new( path to Maildir/ )

new() is a constructor of Sisimai::Mail::Maildir

    my $maildir = Sisimai::Mail::Maildir->new('/home/neko/Maildir/new');

INSTANCE METHODS

path()

path() returns the path to Maildir.

    print $maildir->path;   # /home/neko/Maildir/new

name()

name() returns current file name of the Maildir.

    print $maildir->name;

files()

name() returns i-node list of each email in Maildir.

    print for @{ $maildir->files };

handle()

handle() returns file handle object (IO::Dir) of the Maildir.

    $maildir->handle->close;

read()

read() works as a iterator for reading each email in the Maildir.

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

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.