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!
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!