procmail
[Top] [All Lists]

Re: Extracting variables from perl

2002-01-10 11:19:13
On 10 Jan, Scott Lillibridge wrote:
| I have a procmail recipie that runs an embedded perl script to remove and 
store
| attachments. I generate a unique filename, but I cannot seem to pass this out
| so the following recipie can use it in the email it generates. I have tried
| adding to the $ENV hash and also using 'system' to export the value. I don't
| know if this is a perl question, or a procmail question, so if this is the
| wrong forum, please pardon.
| [...]

It's actually a unix question (probably other OS's too). Children don't
modify the parent's environment. One possible work around would be for
your perl script to write the info you want to file, in a format that
procmail can parse.  Something like:

print FILEHANDLE "filename=$filename\n";

in the perl script (not including the the open and close of FILEHANDLE),
then in your procmail rcfile

INCLUDERC = "the/file/that/FILEHANDLE/pointed/to"

should give you the value of $filename as known to your perl script in a
variable $filename known to procmail. A couple other issues to work out
are 1) removal (if necessary) of the tmp file, 2) safe creation of the
tmp file, and 3) possible regional lockfile around the procmail recipe
(depending on how you answer #1 and #2) to prevent different procmail
processes from clobbering each others files.

Don Hammond

-- 
Reply to list please, or append "6" to "procmail" in address if you must.
Spammers' unrelenting address harvesting forces me to this...reluctantly.


_______________________________________________
procmail mailing list
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>