[Chicago-talk] Re: [Chicago.pm]: advanceing through a file w/o using an array

Ed Summers ehs at pobox.com
Thu Nov 6 11:01:05 CST 2003


> To: "'chicago-pm at topica.com'" <chicago-pm at topica.com>
> From: "Dooley, Michael" <Dooley.Michael at con-way.com>
> Subject: [Chicago.pm]: advanceing through a file w/o using an array

I thought the chicago.pm list at topica was closed down in preference
to the new list at pm.org! [1] Michael, please get on the new list if you
can.

Anyhow, I'm not answering your question really, but you might want to take a
look at Mail::Box [2] on CPAN. Once you've got installed you can interact with 
all sorts of mail folders (mbox, maildir, imap4, pop) with a common interface.

Assuming you've got an mbox format file at /home/bgates/mbox, you could:

    use Mail::Box::Mbox;

    my $folder = Mail::Box::Mbox->new( folder => '/home/bgates/mbox' );

    foreach my $msg ( $folder->messages() ) { 
	print $msg->body(),"\n";
    }

Lazy, and nice to read -- at least for me :) You can do all sorts of 
crazy stuff like deleting, modifying, searching. Well worth a look at
if you need to do lots of work with mail messages.

//Ed

[1] http://chicago.pm.org/discuss.html
[2] http://search.cpan.org/perldoc?Mail::Box




More information about the Chicago-talk mailing list