hacker has asked for the wisdom of the Perl Monks concerning the following question:
The script is an alias in /etc/mail/aliases, so that incoming mail sent to this address, is sent to my script and processed. Originally, the script required that the key=value pairs in this script had to occur in the body of the message itself, in a template I parse with Config::General. I've added the capability to attach the template to the message itself as an attachment (easier for Outlook/Windows users, apparently). So far, so good.
What I'm trying to do now, is "detach" that attachment, store it in a scalar I can manipulate (or even write it to disk, for the moment. I can deal with IO::Scalar on it later to omit the disk hit). When I detach the file, using MIME::Parser, I have a few options, each with their own confusing quirks:
The code I'm using looks like this:
my $md5file = md5_hex($date); my $workpath = "/var/lib/pler"; my $date = UnixDate("today","%b %e, %Y at %T"); my $parser = new MIME::Parser; $parser->output_dir("$workpath"); $parser->output_prefix("$md5file"); my $filer = $parser->filer; $filer->ignore_filename(0); my $entity = $parser->read(\*STDIN);
What I'd like, ideally, is to have the attachment "detached", and named as "$md5file-originalfile.extension", so I can then manipulate it and handle it as a normal file or file-handle-in-a-scalar.
Color me confusigated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Detachments II: The Sequel
by Anonymous Monk on Nov 10, 2003 at 09:32 UTC | |
by Anonymous Monk on Nov 10, 2003 at 09:47 UTC |