Mail::MboxParser and Email::MIME::Attachment::Stripper

A

Arvin Portlock

I'm having a heck of a time trying to get these two
modules to work together. I need to convert a bunch
of mailboxes from pine to Eudora. I need to save
the attachments to a folder, strip them out of the
original email and replace them with a Eudora-style
attachment link. Doing experiments I can get both
modules to work individually but when I try and put
it all together, nothing.

I think it comes down to converting a Mail::MboxParser:Mail
object into an Email::MIME object. But I don't know how
to do that.

use Mail::MboxParser;
use Email::MIME::Attachment::Stripper;

my $mb = new Mail::MboxParser ('test');
open (MBX, ">test.mbx");

while (my $msg = $mb->next_message) {
my @att = $msg->store_all_attachments (path => 'attach');
my $strip = new Email::MIME::Attachment::Stripper ($msg);
my Email::MIME $mime = $strip->message;
print MBX $mime->as_string;
}
close (MBX);

I get the error "Need a message at test.pl line 9". And
of course I do. Stripper requires an Email::MIME object
but next_message returns a Mail::MboxParser::Mail object.
How do I convert the latter into the former?

Secondly, I have never seen this construct before in
perl (it's from the module's examples):

my Email::MIME $mime = $strip->message;

What on Earth does it do?

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,708
Latest member
SherleneF1

Latest Threads

Top