If you want the parts to be written to disk you should not have $parser->output_to_core(1). This tells the parser to write all the decoded data to in-core data structures. By default (if you leave this out) the parts are written to disk.
If your message is in a scalar variable (e.g. $message), rather than being read from a file handle, you can use $parser->parse_data($message).
Something like:
use strict; use warnings; use MIME::Parser; my $message = do { local $/; <DATA>; }; my $parser = MIME::Parser->new(); $parser->output_under("/tmp"); #$parser->output_to_core(1); $parser->parse_data($message) or die "parse failed\n"; __DATA__ MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="frontier" This is a message with multiple parts in MIME format. --frontier Content-Type: text/plain This is the body of the message. --frontier Content-Type: application/octet-stream Content-Transfer-Encoding: base64 PGh0bWw+CiAgPGhlYWQ+CiAgPC9oZWFkPgogIDxib2R5PgogICAgPHA+VGhpcyBpcyB0aG +Ug Ym9keSBvZiB0aGUgbWVzc2FnZS48L3A+CiAgPC9ib2R5Pgo8L2h0bWw+Cg== --frontier--
In reply to Re: MIME::Parser tries but fails to save files
by ig
in thread MIME::Parser tries but fails to save files
by Squiddy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |