#!/usr/bin/perl package Verby::Step; use Moose::Role; our $VERSION = "0.05"; requires "do"; requires "depends"; requires "is_satisfied"; sub provides_cxt { return undef; } sub resources { return ( steps => 1 ); } __PACKAGE__ __END__ =pod =head1 NAME Verby::Step - A base class representing a single thing to be executed by L. =head1 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" }; =head1 DESCRIPTION A step in the L 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 L and a L 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. =head1 METHODS This role provides the C and C methods, with sane default values, and requires C, C and C. See L and L for more reusable behavior. =over 4 =item B Subclass this to return a list of other steps to depend on. =item B This method should return a true value if the step does not need to be executed. Typically a delegation to L. They are named differently, because C implies state. The L will sometimes make assumptions, without asking the step to check that it is satisfied. =item B =item B This is basically a delegation to the corresponding L method. The only interesting thing to do here is to fudge the context up a bit. For example, if your action assumes the C key to be in the context, but you chose C 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"); } L provides a convenient way to get this behavior for free. =item B Returns the list of required resources to allocate with the dispatcher's resource pool, if provided. This defaults to the resource C with the value C<1>, generally intended to control the maximum number of concurrent jobs. =back =head1 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. =head1 CODE COVERAGE We use B to test the code coverage of the tests, please refer to COVERAGE section of the L module for more information. =head1 SEE ALSO =head1 AUTHOR Yuval Kogman, Enothingmuch@woobling.orgE =head1 COPYRIGHT AND LICENSE Copyright 2005-2008 by Infinity Interactive, Inc. L This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut