[Chicago-talk] help with system call

brian d foy brian.d.foy at gmail.com
Wed Jan 19 00:18:51 PST 2011

On Mon, Dec 27, 2010 at 2:18 PM, Kent Cowgill <kent at c2group.net> wrote:
> Better than that, use a perl module from cpan to parse out your mime attachments.
> Wish I could recall the one I've used with great success in the past, but I'm away from a computer and snowed in at the moment, so I can't http://search.cpan.org .

Here's an extract of a mail processing program that I use to do
something similar but from a procmail filter:

use MIME::Parser;

# get the message
my $message    = do { local $/; <> };

# extract the payload
my $parser = MIME::Parser->new();
$parser->output_dir( $tmpdir );
$parser->parse_data( $message );

# count the images.  If there are none, don't do anything
chdir $tmpdir;
my @images = glob( "*.jpg" );
die "No images to process!\n" unless @images;

brian d foy <brian.d.foy at gmail.com>

More information about the Chicago-talk mailing list