I know this is probably a noob question, but I just can't figure out why this is happening like it is. I'm simply trying to deref the value of something inside a system() call. When run, the script pulls mail via IMAP, parses the mail for any TIFF images, converts them to postscript, and prints them via lpr. In this example, it prints out the filename instead. The result:
[jason@lappy ~]$ perl parser.pl /tmp/FAX206984492211_9529539900-14.TIF MIME::Entity=HASH(0x80f74a8)->bodyhandle->path
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).
#!/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;
-fp

In reply to Printing values from references by fuzzyping

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.