Risk-Aware Code Review: Auto Approve Low-Risk Changes
LiveReview LiveReview LiveReview - Free, Risk-Aware Code Review: Auto Approve Low-Risk Changes | Product Hunt LiveReview - Free, Risk-Aware Code Review: Auto Approve Low-Risk Changes | Product Hunt GitHub Install Now

We'd appreciate a star

Catmandu::Validator::Simple - Simple Validator for Catmandu

Configuration

       handler
           A  function  that  takes  a hash reference item as argument. Should return undef if the record passes
           validation otherwise return an error or an arrayref of errors.  Each error can  be  either  a  simple
           message string or a hashref to a more detailed error information.

Description

       Catmandu::Validator::Simple can be used for doing simple data validation in Catmandu.

Name

       Catmandu::Validator::Simple - Simple Validator for Catmandu

See Also

       See Catmandu::Validator for inherited methods, common configuration options, and usage.

perl v5.40.0                                       2025-01-17                   Catmandu::Validator::Simple(3pm)

Synopsis

           use Catmandu::Validator::Simple;

           my $validator = Catmandu::Validator::Simple->new(
               handler => sub {
                   $data = shift;
                   return "error" unless $data->{title} =~ m/good title/;
                   return;
               }
           );

           if ( $validator->is_valid($hashref) ) {
               save_record_in_database($hashref);
           } else {
               reject_form($validator->last_errors);
           }

See Also