shank098 has asked for the wisdom of the Perl Monks concerning the following question:

Hey all

Hoping that someone can give me a hand with this one...

A while back now I created a script which queries a MySQL database with the goal being to send email notifications to the proper tech support staff. It's pretty basic stuff,

If SlotA = Value AND SlotB = Value AND SlotN = value then notify GroupA

So if all the Slots and values in the event match what we have in the DB, then we know who or what group to send the event to. The issue is that it's based completely on AND statements.

The problem that I have found with this method is that I have to create/maintain a ton of filters since all the slots/values have to match.

What I would like to do is something like the following,

If SlotA = Value and SlotB = Value and (SlotC = value OR SlotC = value) then notify GroupA

Anyone have any tips on how to tackle this?

Without getting into too much detail about the DB structure I have one table which holds all my filter information. Here's it structure,

id int(3)
fgid int(3)
slot varchar(20)
value varchar(55)

So an example of a filter might look something like this,

1 - 1 - slotA - value
2 - 1 - slotB - value
3 - 1 - slotC - value
4 - 1 - slotC - value

I am hung up on how to construct the logic in situations where a single slot can have multiple values...the original method with to simply dump all the values from the DB into a Hash and then check that slot/value combos against what was being received from the monitoring system...I am hung up on how to do the "OR" statements...

Any suggestions would be appreciated...