Take me over?
NAME
Verby::Dispatcher - Takes steps and executes them. Sort of like what make(1) is to a Makefile.
SYNOPSIS
use Verby::Dispatcher;
use Verby::Config::Data; # or something equiv
my $c = Verby::Config::Data->new(); # ... needs the "logger" field set
my $d = Verby::Dispatcher->new;
$d->config_hub($c);
$d->add_steps(@steps);
$d->do_all;
DESCRIPTION
METHODS
- new
-
Returns a new Verby::Dispatcher. Duh!
- add_steps *@steps
- add_step *@steps
-
Add a number of steps into the dispatcher pool.
Anything returned from "depends" in Verby::Step is aggregated recursively here, and added into the batch too.
- do_all
-
Calculate all the dependencies using Algorithm::Dependency::Objects, and then dispatch in order.
- dep_engine_class
-
The class used to instantiate the dependecy resolver. Defaults to Algorithm::Dependency::Objects::Ordered. Subclass if you don't like it.
- config_hub ?$new_config_hub
-
A setter getter for the Verby::Config::Data (or compatible) object from which we will derive the global context, and it's sub-contexts.
- global_context
-
Returns the global context for the dispatcher.
If necessary derives a context from "config_hub".
- is_running $step
-
Whether or not $step is currently executing.
- is_satisfied $step
-
Whether or not $step does not need to be executed (because it was already executed or because it didn't need to be in the first place).
- get_cxt $step
-
Returns the context associated with $step. This is where $step will write it's data.
- get_derivable_cxts $step
-
Returns the contexts to derive from, when creating a context for $step.
If $step starts a new context ("provides_cxt" in Step is true) then a new context is created here, derived from get_parent_cxts($step). Otherwise it simply returns get_parent_cxts($step).
Note that when a step 'provides a context' this really means that a new context is created, and this context is derived for the step, and any step that depends on it.
- get_parent_cxts $step
-
If $step depends on any other steps, take their contexts. Otherwise, returns the global context.
- start_step $step
-
If step supports the async interface, start it and put it in the running step queue. If it's synchroneous, call it's "do" in Step method.
- finish_step $step
-
Finish step, and mark it as satisfied. Only makes sense for async steps.
- mark_running $step
-
Put $step in the running queue, and mark it in the running step set.
- push_running $step
-
Push $step into the running step queue.
- pop_running
-
Pop a step from the running queue.
- mk_dep_engine
-
Creates a new object using "dep_engine_class".
- ordered_steps
-
Returns the steps to be executed in order.
- pump_running
-
Give every running step a bit of time to move things forward.
This method is akin to "pump" in IPC::Run.
It also calls "finish_step" on each step that returns false.
- steps
-
Returns a list of steps that the dispatcher cares about.
- step_set
-
Returns the Set::Object that is used for internal bookkeeping of the steps involved.
- running_steps
-
Returns a list of steps currently running.
- running_set
-
Returns the Set::Object that is used to track which steps are running.
- satisfied_set
-
Returns the Set::Object that is used to track which steps are satisfied.
- wait_all
-
Wait for all the running steps to finish.
- wait_one
-
Effectively
finish_step(pop_running)
. - wait_specific $step
-
Waits for a specific step to finish. Called by pump_running when a step claims that it's ready.
BUGS
None that we are aware of. Of course, if you find a bug, let us know, and we will be sure to fix it.
CODE COVERAGE
We use Devel::Cover to test the code coverage of the tests, please refer to COVERAGE section of the Verby module for more information.
SEE ALSO
AUTHOR
Yuval Kogman, <nothingmuch@woobling.org> stevan little, <stevan@iinteractive.com>
COPYRIGHT AND LICENSE
Copyright 2005 by Infinity Interactive, Inc.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.