Class::Workflow::Transition::Simple - A useful class for writing transitions. |
Class::Workflow::Transition::Simple - A useful class (or base class) for writing transitions.
use Class::Workflow::Transition::Simple;
my $t = Class::Workflow::Transition::Simple->new( name => "feed", to_state => $not_hungry, # Class::Workflow::Transition::State body_sets_fields => 1, body => sub { my ( $self, $instance, @args ) = @_;
my $remain = $global_food_warehouse->reduce_quantity;
return ( remaining_food => $remain, ); }, );
Class::Workflow
if any.
Class::Workflow::Transition::Deterministic
.
<sub { }
>) which will be called
during apply, after all validation has passed.
The body is invoked as a method on the transition.
See body_sets_fields
for the semantics of the return value.
This field is present to avoid writing code like this:
return ( {}, @return_values );
When you don't want to set fields in the instance.
Defaults to false (just write return @return_value, set to true to set fields).
See also set_fields
.
body_sets_fields
is false.
If your transition does not need to dynamically set fields you should probably use this.
Defaults to {}
.
This class consumes the following roles:
Class::Workflow::Transition::Simple - A useful class for writing transitions. |