in reply to using a config file

I've had the same challenge and solved it with a tab separated rule file. It could look something like this:

TRANCODE QUANTITY QSIGN KEYCODE HANDLER /(TSP|KSP)/ /^.*(?<!0000000.00000)$/ + /(10|11|20|60)/ se +t(TRAN_CODE, "RCV") /(TSP|KSP)/ * - /(10|11|20|60)/ se +t(TRAN_CODE, "DLV") ...

The table is meant as a lookup table where each value (apart from the values in the rightmost field) are lookup keys that are processed left to right like this:

The different field types have different precedence, so a * will have lower precedence than a regex, which in turn has lower precedence than a literal value.

The rightmost field is just a value that says what to do when matched. It can be a reference to some handler or just a value to insert somewhere.

I do have a module to do this kind of lookup, but it is currently not open source. If you really want it, I can ask the owners if they will let me release it.

Replies are listed 'Best First'.
Re^2: using a config file
by mmittiga17 (Scribe) on Jul 30, 2009 at 14:55 UTC
    Thanks this is a big help. Been racking my brain on this for a while. I would love to try the module if possible. Cheers!