my_zipcode_field => [
'zip',
{
constraint => '/^406/',
name => 'starts_with_406',
}
],
####
ccexpiry => [
'ccexp',
{
constraint => sub {
my ($dfv,$val) = @_;
return $val =~ m/^\d{4}$/,
},
name => 'must be_4_digits'
},
{
constraint => after_today('%m%y'),
name => 'card_expired'
}
],
####
[Thu Jan 31 15:58:27 2013] [error] [client 127.0.0.1] Value for constraint_method 'ccexp' not a code reference or Regexp . Do you need func(), not 'func'? at C:/Perl64/site/lib/Data/FormValidator.pm line 974., referer: http://localhost:9080/test.dfv.html
####
use Business::CreditCard;
use Business::CCCheck;
use Data::FormValidator;
use Data::FormValidator::Constraints qw(:closures);
use Data::FormValidator::Constraints::DateTime qw(:all);