Any idea why the reference in the double-quotes isn't interpreted as I'd expect? I know I've done this sort of thing with other scripts, I assume that I'm just not dealing with the data structure I'd expect (MIME::Parser doesn't document the bodyhandle->path method).[jason@lappy ~]$ perl parser.pl /tmp/FAX206984492211_9529539900-14.TIF MIME::Entity=HASH(0x80f74a8)->bodyhandle->path
-fp#!/usr/bin/perl use strict; use Net::IMAP::Simple; use MIME::Parser; my $out_dir = "/tmp"; + + my $server = new Net::IMAP::Simple('localhost'); $server->login('testuser','password'); my $parser = MIME::Parser->new; $parser->output_dir($out_dir); + + # Create Archive folder if non-existent $server->select('Archive') || $server->create_mailbox('Archive'); + + # Grab number of messages my $number_of_messages = $server->select('INBOX'); + + # Print messages, copy to Archive, delete message foreach my $msg (1..$number_of_messages) { my $msg_fh = $server->getfh($msg); my $entity = $parser->parse($msg_fh); for my $part ($entity->parts) { if ($part->mime_type =~ /tiff/) { print $part->bodyhandle->path, "\n"; print "$part->bodyhandle->path\n"; } } $entity->purge; #$server->copy($msg,'Archive'); #$server->delete($msg); } + + $server->quit;
In reply to Printing values from references by fuzzyping
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |