fuzzyping has asked for the wisdom of the Perl Monks concerning the following question:
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Printing values from references
by gryphon (Abbot) on Sep 13, 2003 at 23:17 UTC | |
by fuzzyping (Chaplain) on Sep 13, 2003 at 23:57 UTC | |
by Fletch (Bishop) on Sep 14, 2003 at 00:31 UTC | |
by fuzzyping (Chaplain) on Sep 14, 2003 at 00:36 UTC | |
by gryphon (Abbot) on Sep 14, 2003 at 05:01 UTC |