Data-Validation

 view release on metacpan or  search on metacpan

lib/Data/Validation.pm  view on Meta::CPAN


   $valids !~ m{ isMandatory }mx and (not defined $v or not length $v)
      and return;

   my $params = $self->constraints->{ $id } // {};
   my $label = $self->fields->{ $id }->{label} // $id;

   for my $methods (grep { $_ ne 'compare' } $_get_methods->( $valids )) {
      my @fails;

      for my $method (split m{ [|] }mx, $methods) {
         my $constraint = Data::Validation::Constraints->new_from_method
            ( { %{ $params }, method => $method, } );
        (my $class = $method) =~ s{ \A is }{}mx;

         if ($constraint->validate( $v )) { @fails = (); last }

         push @fails, $class;
      }

      @fails == 1 and throw sub { $fails[ 0 ] }, [ $label ],



( run in 1.625 second using v1.01-cache-2.11-cpan-71847e10f99 )