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):

if ($last_price > $trigger_level) and ($timenow > $start) and ($timenow < $end) and ($auth == 2) then execute()
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.


In reply to Event loop with rules handling by Brovnik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.