MIMEanalyze.pl

    1 | #!/usr/bin/perl -w
    2 | use MIME::Parser;
    3 | my$parser=MIME::Parser->new;
    4 | $parser->output_to_core(1);
    5 | &analyze($parser->read(\*STDIN),"");
    6 | 
    7 | sub analyze {
    8 |  my($body,$indent,$dot,$parts,$i)=(@_,"");
    9 |  if ($indent eq "") {print "main"} else {$dot="."}
   10 |  print "$indent\t" . $body->mime_type;
   11 |  print "\t" . $body->head->mime_attr("content-type.type") if ($body->mime_type eq "multipart/related");
   12 |  print "\n";
   13 |  return unless $body->mime_type =~ /^multipart\//;
   14 |  $parts=$body->{ME_Parts};
   15 |  for($i=0;$i<=$#{$parts};$i++) {
   16 |    &analyze($$parts[$i],$indent.$dot.$i);
   17 |  }
   18 | }

Valid CSS!Valid HTML 4.01!
© Boris 'pi' Piwinger, September 14, 2001