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.
VS::RuleEngine::Engine
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.
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 step in order for the runloop to work. It called automaticly by run.
step
run
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.
To install VS::RuleEngine, copy and paste the appropriate command in to your terminal.
cpanm
cpanm VS::RuleEngine
CPAN shell
perl -MCPAN -e shell install VS::RuleEngine
For more information on module installation, please visit the detailed CPAN module installation guide.