Took a quick look, noticed something strange
here's the input that I fed into it:
--_000_200907060005UAA14932pisas291mscom88clm_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable line1 line2 line3 --_000_200907060005UAA14932pisas291mscom88clm_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <p>blah</p> <p>blah2</p> --_000_200907060005UAA14932pisas291mscom88clm_-- --_004_38D25DCAD7370B4FACA079E2FAA2C690B02CB5NYWEXMB24msadmsco_--
Here's the code I came up with:
#!/usr/bin/perl use Email::MIME; $file = shift; local( $/, *FILE ) ; open(FILE, $file); $message = <FILE>; close(FILE); my $parsed = Email::MIME->new($message); my @parts = $parsed->parts; # These will be Email::MIME objects, too. my $p = $parts[1]->content_type; print $p;
That is pretty much from the module's documentation. Here's the result it produces, when I run it:
$ ./grab.pl mime2 Can't call method "content_type" on an undefined value at ./grab.pl li +ne 16. $
Shouldn't $parts[1] contain the second MIME in my input (html)? why's it undef'ed? and if I use @parts in scalar context, it claims there's only 1 mime part in that input, which is also a blatant lie. :)
$parts[0] seems to contain what it's supposed to. it returns 'text/plain; charset="iso-8859-1"' as its supposed to. where'd $parts[1] go? :D
Did I misinterpret the documentation somehow?
In reply to Re^2: MIME voodoo.
by vxp
in thread MIME voodoo.
by vxp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |