Class::Workflow::Transition - A function over an instance.
package MyTransition; use Moose; with 'Class::Workflow::Transition';
This is the base role for transition implementations.
every transition object must comply to it's interface, and furthermore must also use the derive_and_accept_instance method to return a derived instance at the end of the operation.
derive_and_accept_instance
This method calls $instance->derive with the attrs, and then calls the instance accept_instance on the new instance's state.
$instance->derive
accept_instance
%attrs must contain the key state, which should do the role Class::Workflow::State.
%attrs
state
@args are passed (along with the derived instance) to "accept_instance" in Class::Workflow::State.
This method accepts a Class::Workflow::Instance as it's first argument, and is expected to call $self->derive_and_accept_instance( $instance, \%attrs, @args ), with %attrs containing the state that the instance is being transferred to (it doesn't have to be different than the current state).
$self->derive_and_accept_instance( $instance, \%attrs, @args )
To install Class::Workflow, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Workflow
CPAN shell
perl -MCPAN -e shell install Class::Workflow
For more information on module installation, please visit the detailed CPAN module installation guide.