Re: [exim] two failing approaches to solving my problem - lo…

Góra strony
Delete this message
Reply to this message
Autor: Dan_Mitton
Data:  
Dla: exim-users.josh
CC: exim-users
Temat: Re: [exim] two failing approaches to solving my problem - looking for help
Josh,

Your condition should look something like:

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

but you might be running into a parsing/expansion problem. What does the
stuff the 'perl{mySub}...' return look like? Do you need to quote or
otherwise escape some things?

Dan



Sent by:        exim-users-bounces@???
To:     exim-users@???
cc:      (bcc: Dan Mitton/YD/RWDOE)
Subject:        [exim] two failing approaches to solving my problem - 
looking for     help
LSN: Not Relevant
User Filed as: Not a Record


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

--
## List details at http://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/