VS::RuleEngine::Runloop - Runs engine(s)
use VS::RuleEngine::Runloop; my $engine1 = MyApp::Engine->get_engine(); my $engine2 = MyApp::Engine->get_another_engine(); my $runloop = VS::RuleEngine::Runloop->new(); $runloop->add_engine($engine1); $runloop->add_engine($engine2); # Run the two engines until there's no more processing # to be done in either of them $runloop->run();
This class converts engine descriptions (
VS::RuleEngine::Engine-instances) into something runnable and executes them.
If multiple engines are defined in a single runloop execution will continue until no engines have anything ore to process. Engines that report they are done processing are removed from the runloop.
Creates a new runloop instance.
- add_engine ( ENGINE [, GLOBALS] )
Adds an engine to the runloop. An optional VS::RuleEngine::Data instance can be passed as global data for the engine. If omitted a empty VS::RuleEngine::Data instance will be created and used as global.
Initializes the runloop. Must be called before
stepin order for the runloop to work. It called automaticly by
Performs one iteration in the runloop. Returns the number of engines that are still in the runloop. When there is no more work to be done it returns 0.
Runs the engine until there is no more work to perform.