[exim] two failing approaches to solving my problem - lookin…

Top Page
Delete this message
Reply to this message
Author: exim-users.josh
Date:  
To: exim-users
Subject: [exim] two failing approaches to solving my problem - looking for help
I'm [probably yet] a[nother] new user introducing himself to the list
by asking for help - that ever happen before? :) I need to do some
custom processing/chewing on $local_part with perl, then search for
the result in a text file. I'm currently using perl to do the chewing
and the searching, but would prefer to use Exim directly for the
searching.

First, my general question, since it will haunt me well beyond my
immediate problem - is there a way to have persistent (e.g. global or
package-scoped) variables (including hashes, arrays, and
objects/things like database connections) across multiple calls to
perl, other than the pre-defined scalars offered by Exim?

In this case, I'm loading up multiple lines in a text file into a
global hash in perl, hoping to do it once and read from the hash
subsequently, but I find the hash is undefined at the start of each
call, and the code has to read the file again. Therefore, I figure
each new call is in a different and fresh lexical scope and so my hash
is gone. The code is ostensibly working, mind you, but it's doing a
lot of needless reading/IO on the text file (once for each incoming
message), and soon the system will be under heavy load.

Another (preferred, in this case) approach to my immediate problem
would be to use a return value from a perl sub as something for Exim
to lookup in my text file, which has many single word values separated
by newlines. In my ACL, I tried

condition = ${lookup{perl{mySub}{$local_part}}{/etc/exim4/myTextFile.txt}}

(also tried an lsearch in front of the text file part) -- but I just
get the "missing lookup type" error. mySub, in the example, would
return the properly chewed-up version of $local_part. For the
purposes of my question, please assume I'm unable to get what I want
from a native regex instead of the mySub code (because it's true :) )

Any pointers? Thanks in advance!!!

Josh