Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Saving certain email attachements using MIME::Tools

by neilwatson (Priest)
on Aug 30, 2002 at 13:18 UTC ( #194100=note: print w/replies, xml ) Need Help??


in reply to Re: Saving certain email attachements using MIME::Tools
in thread Saving certain email attachements using MIME::Tools

$body returns: MIME::Body::InCore=HASH(0x83a39ac) while $filename comes out blank.

Update

foreach $x (@attypes){ if ($subentity->mime_type =~ m/$x/i){ $attachment = $subentity->bodyhandle->print(); push @attachment, $attachment; print "x = $x subentity =".$subentity->mime_type."\n"; push @attname, $subentity->head->mime_attr('content-disposition. +filename'); } }

The attachment prints out but is not stored in $attachment. @attname now holds the attachment name correctly. All that remains is figuring out how to store the attachement into a variable for later use.

Neil Watson
watson-wilson.ca

Replies are listed 'Best First'.
Re: Re: Re: Saving certain email attachements using MIME::Tools
by blahblahblah (Priest) on Sep 03, 2002 at 04:28 UTC
    You're setting $attachment to the return value of the print() method. The perldoc for MIME:Body doesn't say anything about print() returning anything. There are other methods that look like they'll do what you want, like as_string() and as_lines().

    MIME::Tools has some of the better documentation I've seen for modules, with lots of examples. You should run "perldoc MIME::Body" or look at these pages on perldoc.com:
    http://www.perldoc.com/cpan/MIME-tools.html
    http://www.perldoc.com/cpan/MIME/Body.html

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://194100]
help
Chatterbox?
[jdporter]: ok, I need a recipe for piping lines "through" an external program which is itself a filter
[jdporter]: without using a tmp file
[1nickt]: tobyink perl -MTypes::Standard= is_Int -Mstrict -wE 'say 1 if is_Int 1.0'
[jdporter]: so that I can use the existing expand unix util. Otherwise, I'll probably use Text::Tabs.
[1nickt]: pryrt I guess I don;t really care if user 42 logs on as 42.0 ... more of an academic question at this point.
[LanX]: jdporter: open PIPE,'-|' ?
[LanX]: oh you want the result line by line?
[jdporter]: ok, LanX, then what?
[jdporter]: It doesn't have to be line by line. Just "my program" "writes" to the external prog and also/then "reads" from it.
LanX open (You are not allowed to open to a command that pipes both in and out, but see IPC::Open2, IPC::Open3, and Bidirectional Communication with Another Process in perlipc for alternatives.)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (13)
As of 2017-05-24 20:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?