GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Sisimai::Mail::Mbox(3) User Contributed Perl Documentation Sisimai::Mail::Mbox(3)

Sisimai::Mail::Mbox - Mailbox reader

    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
    }

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

"new(path to mbox)"

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

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

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

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

path() meethod returns the path to the mbox.

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

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

    print $mailbox->file;   # root

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

    print $mailbox->size;   # 94515

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() method returns file handle object "IO::File" of the mbox.

    $mailbox->handle->close;

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
    }

azumakuniyuki

Copyright (C) 2014-2016,2018,2019,2021,2024 azumakuniyuki, All rights reserved.

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

2025-03-28 perl v5.40.2

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.