Perl parsing multipart/mixed email

I'm trying to parse a multipart/mixed email with Email::MIME. I have it working for many types, but can't figure out why it won't properly detect this type.

I have a script that works successfully with many types of emails, but this particular type does not work. It fails with "can't get body as a string for multipart/mixed;"

The bulk of the actual content that I want is in the text/plain part, but it seems to choke on the multipart/mixed part prior to that.

As I'd also like the script to be able to handle emails with different encoding, I'd also like to have an if/else that attempts to decode all different types, and be able to identify the most significant part of each email.

I believe I have that ordering right, but it still fails to decode the text/plain part that appears before the multipart/mixed part.

my @mailData;
my $msg = Email::MIME->new($buf);

 $msg->walk_parts(sub {
     my ($part) = @_;
     warn($part->content_type . ": " . $part->subparts);
     if (($part->content_type =~ /text\/plain$/i) && !@mailData) {
        #print $part->body;
        @mailData = split( '\n', $part->body_str);
     }
     elsif (($part->content_type =~ m/multipart\/mixed\;/i) && !@mailData) {
        print $part->body;
        @mailData = split( '\n', $part->body_str);
     }
     elsif (($part->content_type =~ /text\/plain; charset=\"?utf-8\"?/i) && !@mailData) {
        #print $part->body;
        @mailData = split( '\n', $part->body_str);
     }
     elsif (($part->content_type =~ /text\/plain; charset=\"?us-ascii\"?/i) && !@mailData) {
        #print $part->body;
        @mailData = split( '\n', $part->body_str);
     }
     elsif (($part->content_type =~ /text\/plain; charset=\"?windows-1252\"?/i) && !@mailData) {
        #print $part->body;
        @mailData = split( '\n', $part->body_str);
     }
     elsif (($part->content_type =~ /text\/plain; charset=\"?iso-8859-1\"?/i) && !@mailData) {
        print $part->body;
        @mailData = split( '\n', $part->body_str);
     } else { print "failed: $subject\n"; exit 0; }
 });

When I pass a complete email to it, it prints:

        Email::MIME::body_str(Email::MIME=HASH(0x55dccceb9510)) called at alert11a.pl line 157
        main::__ANON__(Email::MIME=HASH(0x55dccceb9510)) called at /usr/share/perl5/vendor_perl/Email/MIME.pm line 845
        Email::MIME::__ANON__(Email::MIME=HASH(0x55dccceb9510)) called at /usr/share/perl5/vendor_perl/Email/MIME.pm line 875
        Email::MIME::walk_parts(Email::MIME=HASH(0x55dccceb9510), CODE(0x55dcccf101a0)) called at alert11a.pl line 175
multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="n1iI6MeELQa9IOaF"text/plain; charset="utf-8"

I've also tried several methods to print out all subparts of the email, but "warn($part->content_type . ": " . $part->subparts);" seems to choke on this one.

Here they are as I see them visually:

Content-Type: multipart/mixed; boundary="===============0130613217382308956=="

--===============0130613217382308956==
Content-Type: multipart/signed; micalg=pgp-sha512;
        protocol="application/pgp-signature"; boundary="n1iI6MeELQa9IOaF"
Content-Disposition: inline


--n1iI6MeELQa9IOaF
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

--n1iI6MeELQa9IOaF
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEpgY7tWAjCaQ8jrvULwmejQBegfQFAlzbUr0ACgkQLwmejQBe
gfQbvQ//RvytLvg0+M2YxHs7Pnw0etafzK7NcQ5mSH9V+WYNXCLCs9aOdYbS8JvA
...[trimmed]

--===============0130613217382308956==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

LS0gCnVidW50dS1zZWN1cml0eS1hbm5vdW5jZSBtYWlsaW5nIGxpc3QKdWJ1bnR1LXNlY3VyaXR5... [trimmed]

I can provide a link the whole email if necessary