|Welcome to the Monastery|
Event loop with rules handlingby Brovnik (Hermit)
|on Nov 03, 2004 at 22:07 UTC||Need Help??|
Brovnik has asked for the
wisdom of the Perl Monks concerning the following question:
I am about to start on a largish project and one of the modules is what I have called the "watcher".
This will manage a set of rules, and watch for external events. If any external event could affect the rules, then the (many) rules in the active rules list will get reevaluated and any that fire will be processed.
I've looked around but haven't seen anything that might help with the rules / event loop. Has anyone seen something like this ?
More info :
The rules will be something like (rules syntax not yet defined):
The intention is that the rules can be written by a non-programmer (but someone with deep knowledge of the domain).
The variables (e.g. $last_price) will get changed by external (to the rules) events, so on one evaluation pass, a rule could evaluate false, but shortly after, could evaluate true and need to fire.
This is a bit similar to an Expert System that I worked on once, but, in this case, there is no searching, one rule does not lead to another, and all rules are in the form if (conditions) then execute(actions).
Some of the actions could lead to other rules being added or deleted though.
Any pointers appreciated before I start building something from scratch.