NAME
Form::Factory::Feature::Role::Check - features that check control values
VERSION
version 0.008
SYNOPSIS
package MyApp::Feature::Bar;
use Moose;
with qw(
Form::Factory::Feature
Form::Factory::Feature::Role::Check
);
sub check {
my $self = shift;
# Check the value for errors, it must contain Bar
my $value = $self->control->{something}->current_value;
unless ($value =~ /\bBar\b/) {
$self->result->error('control must contain Bar');
$self->result->is_valid(0);
}
else {
$self->result->is_valid(1);
}
}
DESCRIPTION
Features that check the correctness of control values implement this role. This runs after input has been consumed and cleaned and before it is processed. The check here is meant to verify whether the input is valid and ready for processing. Mark the result as invalid to prevent processing. In general, it's a good idea to return an error if you do that. This is also a good place to return warnings.
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2009 Qubling Software LLC.
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.