Data::FormValidator::Constraints::MethodsFactory

Data::FormValidator::Constraints::MethodsFactory can create constraints for Data::FormValidator.
Download

Data::FormValidator::Constraints::MethodsFactory Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Graham TerMarsch
  • Publisher web site:
  • http://search.cpan.org/~gtermars/Data-FormValidator-Constraints-MethodsFactory-0.01/lib/Data/FormValidator/Constraints/MethodsFactory.pm

Data::FormValidator::Constraints::MethodsFactory Tags


Data::FormValidator::Constraints::MethodsFactory Description

Data::FormValidator::Constraints::MethodsFactory can create constraints for Data::FormValidator. Data::FormValidator::Constraints::MethodsFactory can create constraints for Data::FormValidator.SYNOPSIS use Data::FormValidator::Constraints::MethodsFactory qw(:set :num :bool); # SET constraints (:set) constraint_methods => { status => FV_set(1, qw(new active disabled)), how_many => FV_set_num(1, (1 .. 20)), province => FV_set_word(1, "AB QC ON TN NU"), seen_before => FV_set_cmp(1, sub { $seen{$_} }, qw(foo bar)), } # NUMERIC constraints (:num) constraint_methods => { how_many => FV_clamp(1, 1, 10), small_amount => FV_lt(1, 3), large_amount => FV_gt(1, 10), small_again => FV_le(1, 3), large_again => FV_ge(1, 10), } # BOOLEAN constraints (:bool) constraint_methods => { bad_status => FV_not( FV_set(1, qw(new active disabled)) ), email => FV_or( FV_set(1,$current_value), Data::FormValidator::Constraints::email(), ), password => FV_and( FV_length_between(6,32), my_password_validation_constraint(), ), }Data::FormValidator::Constraints::MethodsFactory provides a variety of functions that can be used to generate constraint closures for use with Data::FormValidator.The functions/constraints provided are based on those from Data::FormValidator::ConstraintsFactory, BUT are designed to be used as "new-style" constraints (while Data::FormValidator::ConstraintsFactory was designed for use with "old-style" constraints). Functionally, this module provides equivalents for all of the constraints that were in Data::FormValidator::ConstraintsFactory, but if you're trying to do things with the new-style you'll want to use the versions from this module instead. Requirements: · Perl


Data::FormValidator::Constraints::MethodsFactory Related Software