Problems with function dump_entity from example distributed with MIME::tools

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

I am using Activestate perl 5.10.0 on WXP, if that matters.

I tried function dump_entity from mimedump, distributed with the
latest release of MIME::tools.  It looked simple enough, but when I
pass to it the emails I get from the IMAP server (using
Net::IMAP::Simple::SSL), it prints nothing.

I can print any and all of the headers, using, e.g. other examples
provided in the documentation, and using length($es->body), I get a
length of anywhere from a few kilobytes to over 1 MB.  But still,
function dump_entity prints nothing.  For some reason that is
presently beyond me, MIME::Parser fails to correctly identify any of
the message parts.  If I use the appended functions to print the
messages I get from the IMAP server, I see all the lines containing
all the content of the message, including html and uuencoded image
data from messages where the body is html and includes jpg, gif and
png files referred to by img tags in the html.

The following sequence prints all of the hierarchical  data in
$message in a way in which I can see the hierarchical nature of the

  my $message = $imap->get($j);
  print "Message: $j\n";
  print_obj($message);# my function, given below

but, the following:

my $parser = new MIME::Parser;

  my @l2 = @;
  my $entity = $parser->parse_data(@l2);

Prints the correct skeleton (undoubtedly from the call to
dump_skeleton), but no content.  I don't understand why.  I tried to
use the code in the examples, and the documentation, carefully, but I
don't see why I can't get at the html content (so i can parse it) or
to save to usable files, and describe, any binary content.

Any help would be appreciated.



========my functions  = not pretty, but servicable for what they were
writen for=======
========NB: print_obj is only for scalars and references to arrays and
===========it is NOT intended to be used on arrays or hashes
===========thus to print a hash, call print_obj(\%myhash), not
sub print_obj {
  my ($obj,$lvl) = @_;
  $lvl = 0 unless defined $lvl;
  if (ref($obj) eq 'HASH') {
    my %h = %;
    foreach my $key (keys %h) {
      print "KEY: $key\nVALUE(s)";
  } else {
    if (ref($obj) eq 'ARRAY') {
      my @a = @;
      foreach my $ai (@a) {
    print "ARRAY item\n";
    } else {
      if (ref($obj) eq 'SCALAR') {
    print "$$obj\n";
      } else {
    print "$obj\n";

sub print_n_tabs {
  my $n = shift;
  my $i = 0;
  while ($i < $n) {
    print "\t";

Site Timeline