The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Verby::Step - A base class representing a single thing to be executed by Verby::Dispatcher.

SYNOPSIS

        package MyStep;
        use Moose;

        with qw/Verby::Step/;

Or perhaps more easily using:

        use Verby::Step::Closure qw/step/;
        my $step = step "Some::Action",
                sub { warn "before" },
                sub { warn "after" };

DESCRIPTION

A step in the Verby system is like an instance of an action.

A step is much like a makefile target. It can depend on other steps, and when appropriate will be told to be executed.

The difference between a Verby::Step and a Verby::Action is that an action is usually just reusable code to implement the verification and execution

A step manages the invocation of an action, typically by massaging the context before delegating, and re-exporting meaningful data to the parent context when finished. It also tells the system when to execute, by specifying dependencies.

The distinction is that an action is something you do, and a step is something you do before and after others.

METHODS

This role provides the provides_cxt and resources methods, with sane default values, and requires depends, is_satisfied and do. See Verby::Step::Simple and Verby::Step::Closure for more reusable behavior.

depends

Subclass this to return a list of other steps to depend on.

is_satisfied

This method should return a true value if the step does not need to be executed.

Typically a delegation to "verify" in Verby::Action. They are named differently, because is_satisfied implies state. The Verby::Dispatcher will sometimes make assumptions, without asking the step to check that it is satisfied.

provides_cxt
do

This is basically a delegation to the corresponding Verby::Action method.

The only interesting thing to do here is to fudge the context up a bit. For example, if your action assumes the path key to be in the context, but you chose the_path_to_the_thing to be in your config, this is the place to do:

        sub do {
                my ($self, $c) = @_;

                # prepare for the action
                $c->path($c->the_path_to_the_thing);

                $self->action->do($c);

                # pass data from the action to the next steps
                $c->export("some_key_the_action_set");
        }

Verby::Step::Closure provides a convenient way to get this behavior for free.

resources

Returns the list of required resources to allocate with the dispatcher's resource pool, if provided.

This defaults to the resource steps with the value 1, generally intended to control the maximum number of concurrent jobs.

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>

COPYRIGHT AND LICENSE

Copyright 2005-2008 by Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.