I'm not actually a total Perl beginner, but there are sizeable parts of
the language that I know nothing about, and I'm kind-of in a hurry today,
so maybe somebody will take pity and just point me in the right direction.
The sitiation is simple... I have an e-mail message whose topmost header
says that it is multipart/mixed. Under that, there is really only one part,
and that part has a header that declares the part as being:
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Ok, so forget about the content type and encoding for the moment. I just
want to print out the content of that one MIME part... really, _just_ the
body of just that one MIME part.
I don't think I ever used MIME Tools or MIME::Parser before, so I'm not really
familiar with these particular packages.
I tried this:
==========================================================================
#!/usr/local/bin/perl -w
use strict;
use MIME::Parser;
my $parser = new MIME::Parser;
my $entire = $parser->parse(\*STDIN) or die "parse failed\n";
my $part0 = $entire->parts(0);
my $gunk = $part0->body;
print $gunk->as_lines;
==========================================================================
Unfortunately, running the above code only causes the following error
message:
Can't call method "as_lines" on unblessed reference at ./showhtml line 15.
Do I need to apply for special dispensation from the Pope, or what?
Any help would be appreciated. I really have no idea what I did wrong.
Regards,
rfg
P.S. When and if I do ever manage to get the body of the first part of
the ``multipart'' MIME e-mail message in question, I am immediately going
to want to decode it from "quoted-printable" to an unencoded byte stream.
If anybody could show me the proper way to do that also, I'd appreciate it.
Thanks.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/