title: Perl parsing multipart/alternative emails
body: <p>I looking for a way to parse the body text part of multipart/alternative emails. I have currently have a perl script using the Email::Mime module, which parses text/plain and text/html correctly. Though the problem I have is that when I parse a multipart/alternative email the $part->body always returns empty. I have tried using $part->body_raw and it does return the text body though it includes the header which I need to omit. </p>
  
  <h3>Current output using $part->data_raw</h3>
  
  <pre><code>--_000_47C8E15E8EEDCB4E94E891F9414C019A0CB5BDEE79DFW1MBX07mex0_
  Content-Type: text/plain; charset="us-ascii"
  Content-Transfer-Encoding: quoted-printable 
  
  Text Body 
  </code></pre>
  
  <h3>Desired Output</h3>
  
  <pre><code>Text Body
  </code></pre>
  
  <p>PERL Code</p>
  
  <pre><code>my ( $body, $text_body, $html_body, $multi_body );
  for my $part (@parts) {
  
  if ( $part-&gt;content_type =~ m!text/html! ) {
      my $hs = HTML::Strip-&gt;new( emit_spaces =&gt; 0 );
      $html_body .= $hs-&gt;parse( $part-&gt;body );
      print "Found HTML\n";
  }
  elsif ($part-&gt;content_type =~ m!text/plain!
      or $part-&gt;content_type eq '' )
  {
  
      $text_body .= $part-&gt;body;
      print "Found TEXT\n";
  }
  elsif ($part-&gt;content_type =~ m!multipart/alternative!
      or $part-&gt;content_type eq '' )
  {
      print "Found Multipart\n";
      $multi_body .= $part-&gt;body;     
  
  }
  </code></pre>
  
  <p>Source</p>
  
  <pre><code>Content-Type: multipart/related;
  boundary="_004_47C8E15E8EEDCB4E94E891F9414C019A0CB5BDEE79DFW1MBX07mex0_";
  type="multipart/alternative"
  MIME-Version: 1.0
  
  --_004_47C8E15E8EEDCB4E94E891F9414C019A0CB5BDEE79DFW1MBX07mex0_
  Content-Type: multipart/alternative;
  boundary="_000_47C8E15E8EEDCB4E94E891F9414C019A0CB5BDEE79DFW1MBX07mex0_"
  
  --_000_47C8E15E8EEDCB4E94E891F9414C019A0CB5BDEE79DFW1MBX07mex0_
  Content-Type: text/plain; charset="us-ascii"
  Content-Transfer-Encoding: quoted-printable
  
  Test Body
  </code></pre>