.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Sisimai::Mail::Mbox 3pm" .TH Sisimai::Mail::Mbox 3pm 2024-05-24 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Sisimai::Mail::Mbox \- Mailbox reader .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 5 \& use Sisimai::Mail::Mbox; \& my $mailbox = Sisimai::Mail::Mbox\->new(\*(Aq/var/spool/mail/root\*(Aq); \& while( my $r = $mailbox\->read ) { \& print $r; # print contents of each mail in mbox \& } .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Sisimai::Mail::Mbox is a mailbox file (UNIX mbox) reader. .SH "CLASS METHODS" .IX Header "CLASS METHODS" .ie n .SS """\fBnew(path to mbox)\fP""" .el .SS "\f(CW\fP\f(CBnew(path to mbox)\fP\f(CW\fP" .IX Subsection "new(path to mbox)" \&\f(CWnew()\fR is a constructor of Sisimai::Mail::Mbox .PP .Vb 1 \& my $mailbox = Sisimai::Mail::Mbox\->new(\*(Aq/var/mail/root\*(Aq); .Ve .SH "INSTANCE METHODS" .IX Header "INSTANCE METHODS" .ie n .SS """\fBdir()\fP""" .el .SS \f(CW\fP\f(CBdir()\fP\f(CW\fP .IX Subsection "dir()" \&\f(CWdir()\fR returns the directory name of mbox .PP .Vb 1 \& print $mailbox\->dir; # /var/mail .Ve .ie n .SS """\fBpath()\fP""" .el .SS \f(CW\fP\f(CBpath()\fP\f(CW\fP .IX Subsection "path()" \&\f(CWpath()\fR returns the path to mbox. .PP .Vb 1 \& print $mailbox\->path; # /var/mail/root .Ve .ie n .SS """\fBfile()\fP""" .el .SS \f(CW\fP\f(CBfile()\fP\f(CW\fP .IX Subsection "file()" \&\f(CWfile()\fR returns a file name of the mbox. .PP .Vb 1 \& print $mailbox\->file; # root .Ve .ie n .SS """\fBsize()\fP""" .el .SS \f(CW\fP\f(CBsize()\fP\f(CW\fP .IX Subsection "size()" \&\f(CWsize()\fR returns the file size of the mbox. .PP .Vb 1 \& print $mailbox\->size; # 94515 .Ve .ie n .SS """\fBoffset()\fP""" .el .SS \f(CW\fP\f(CBoffset()\fP\f(CW\fP .IX Subsection "offset()" \&\f(CWoffset()\fR returns offset position for seeking the mbox. The value of "offset" is bytes which have already read. .PP .Vb 1 \& print $mailbox\->offset; # 0 .Ve .ie n .SS """\fBhandle()\fP""" .el .SS \f(CW\fP\f(CBhandle()\fP\f(CW\fP .IX Subsection "handle()" \&\f(CWhandle()\fR returns file handle object (IO::File) of the mbox. .PP .Vb 1 \& $mailbox\->handle\->close; .Ve .ie n .SS """\fBread()\fP""" .el .SS \f(CW\fP\f(CBread()\fP\f(CW\fP .IX Subsection "read()" \&\f(CWread()\fR works as a iterator for reading each email in the mbox. .PP .Vb 4 \& my $mailbox = Sisimai::Mail\->new(\*(Aq/var/mail/neko\*(Aq); \& while( my $r = $mailbox\->read ) { \& print $r; # print each email in /var/mail/neko \& } .Ve .SH AUTHOR .IX Header "AUTHOR" azumakuniyuki .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (C) 2014\-2016,2018,2019,2021,2024 azumakuniyuki, All rights reserved. .SH LICENSE .IX Header "LICENSE" This software is distributed under The BSD 2\-Clause License.