Form::Factory::Feature::Role::Check - features that check control values
version 0.008
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); } }
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.
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
<hanenkamp@cpan.org>
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.
To install Form::Factory, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Form::Factory
CPAN shell
perl -MCPAN -e shell install Form::Factory
For more information on module installation, please visit the detailed CPAN module installation guide.