Kvasir::Runloop - Runs engine(s)
use Kvasir::Runloop; my $engine1 = MyApp::Engine->get_engine(); my $engine2 = MyApp::Engine->get_another_engine(); my $runloop = Kvasir::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 (Kvasir::Engine-instances) into something runnable and executes them.
Kvasir::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 Kvasir::Data instance can be passed as global data for the engine. If omitted a empty Kvasir::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 Kvasir, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Kvasir
CPAN shell
perl -MCPAN -e shell install Kvasir
For more information on module installation, please visit the detailed CPAN module installation guide.