
MIME::Parser::TreeFiler - file messages into a directory tree

### Place message parts in subdirectories of "/tmp/msgs":
$filer = MIME::Parser::TreeFiler->new("/tmp/msgs");
$parser->filer($filer);

This concrete subclass of MIME::Parser::Filer supports filing under a given directory, using one subdirectory per message, but with all message parts in the same directory.

Instance method, initiallizer. Set the base directory which will contain the message directories. If used, then each parse of begins by creating a new subdirectory under BASEDIR where the actual parts of the message are placed.
Instance method. Return the base directory we were created with, which is the parent of the directories created for each individual message.
Instance method, for subclasses only. A new message is being parsed; synthesize a name of a new subdirectory under the "base_dir" where the message will be placed.
The default creates a name like:
msg-{unixtime}-{process id}-{sequence number}
If you don't like this, subclass and override.
Instance method. Return the last message directory set up by init_parse(). This lets you write code like this:
$filer = new MIME::Parser::TreeFiler->("/tmp");
$parser->filer($filer);
...
$ent = eval { $parser->parse_open($msg); };
if (!$ent) { ### parse failed
die "parse failed: garbage is in ".$parser->last_message_dir."\n";
...
}
else { ### parse succeeded
...do stuff...
}
Instance method, override. Returns the output directory for the entity with the given HEAD; this will be used by output_path() to create the full path needed by the MIME::Parser.