Class::Workflow::Transition::Validate::Simple - Easier validation code.
package MyTransition; use Moose; with qw/Class::Workflow::Transition::Validate::Simple/; # ... $t->clear_validators; $t->add_validators( sub { ... } );
This is useful if your validators only throw exceptions.
Defaults to false
This contains a state that will be moved to if a validation error occurs.
In conjunction with Class::Workflow::State::AutoApply this can work like a catch block.
The instance will have the error attribute set.
error
If this is set, validation_error will not die even if error_state is not set.
validation_error
error_state
The instance will have the error attribute set, and will be reaccepted into it's current state, with the error.
This is an optional list of sub refs which will be called to validate input before applying body.
body
They should raise an exception or return a false value if the input is bad.
They may put validation result information inside the Class::Workflow::Context or equivalent, if one is used.
A more comprehensive solution is to override the validate method yourself and provide rich exception objects with validation error descriptors inside them.
validate
The validators are invoked as methods on the transition.
IF ignore_validator_rv is true then only exceptions are considered input validations.
ignore_validator_rv
Modify the list of validators.
This role consumes the following roles:
Class::Workflow::Transition::Validate
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.