in reply to MIME::Parser and applefile

I would suggest doing your match on the $part->effective_type rather than on the whole $head->as_string.

I'm not sure what you mean by the parser failing. Is that some other part of your program? This part works fine for me. I'd recommend structuring your loop more like this:

foreach my $part (@parts) { next unless defined $part->head; my $type = $part->effective_type; my $filename = $part->head->recommended_filename || ""; if ($type =~ m!application/applefile!i) { # print STDERR "skipping: $type $filename\n"; next; } my @thispart = ($part->head->as_string, $part->bodyhandle->as_string); if ($type =~ /^image/i || ($type =~ /application|octet/i && $filename =~ /\.gif$/i)) { push @images, \@thispart; } elsif ($type =~ /^text/i) { push @text, \@thispart; } }

Replies are listed 'Best First'.
Re: Re: MIME::Parser and applefile
by Anonymous Monk on Jul 08, 2003 at 14:12 UTC
    Thanks. I havn't tried it yet, but it+ looks nice! and I'm always looking for something to make the crappy code better.