[Mimedefang] Constructing MIME::Entity via new
Philip Prindeville
philipp_subx at redfish-solutions.com
Tue Apr 30 13:39:57 EDT 2013
I'm not quite getting something in the MIME::Entity documentation. It says:
PUBLIC INTERFACE
Construction
new [SOURCE]
Class method. Create a new, empty MIME entity. Basically, this
uses the Mail::Internet constructor...
If SOURCE is an ARRAYREF, it is assumed to be an array of lines
that will be used to create both the header and an in-core body.
Else, if SOURCE is defined, it is assumed to be a filehandle from
which the header and in-core body is to be read.
Note: in either case, the body will not be parsed: merely read!
but when I try:
my $pop = Net::POP3->new('localhost', Port => 8110, Timeout => 15, Debug => $debug);
...
for (my $i = 1; $i <= $msgs; ++$i) {
my $lines = $pop->top($i, 0);
my $msg = MIME::Entity->new($lines); << line 38
print $msg->as_string();
}
I end up seeing:
you cannot use body() to set the encoded contents
at ./test070.pl line 38
which seems to contradict the manual.
How does one normally construct a MIME::Entity from the stream off-the-wire? I don't really care if the body is parsed or not, since I'm obviously only fetching the headers (i.e. the "body-lines" count to Net::POP3::top() is 0).
Thanks,
-Philip
More information about the MIMEDefang
mailing list