Subject: | Unable to get body for parsed message from attached email |
Error reports from the following code where $mail_as_string is the included file.
my $mail_as_mime = Email::MIME->new($mail_as_string);
print $mail_as_mime->body,"\n";
my $stripper = Email::MIME::Attachment::Stripper->new
($mail_as_mime, 'force_filename' => 1); print $stripper->message->header('Subject'),"\n";
Error on last line above appears as follows:
Can't call method "body" on an undefined value at
/usr/share/perl5/Email/MIME/Modifier.pm line 244 (#1)
(F) You used the syntax of a method call, but the slot filled by the
object reference or package name contains an undefined value. Something
like this will reproduce the error:
$BADREF = undef;
process $BADREF 1,2,3;
$BADREF->process(1,2,3);
Uncaught exception from user code:
Can't call method "body" on an undefined value at /usr/share/perl5/Email/MIME/Modifier.pm line 244.
Email::MIME::parts_set('Email::MIME=HASH(0x8b37db0)', 'ARRAY(0x8925ca4)') called at /usr/share/perl5/Email/MIME/Attachment/Stripper.pm line 114
Email::MIME::Attachment::Stripper::_detach_all('Email::MIME::Attachment::Stripper=HASH(0x89e521c)') called at /usr/share/perl5/Email/MIME/Attachment/St ripper.pm line 88
Email::MIME::Attachment::Stripper::message('Email::MIME::Attachment::Stripper=HASH(0x89e521c)') called at bin/imap.t line 62
1..12
# Looks like your test died just after 12.
Message body is not shown because it is too large.