The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

MooseX::DFV - Data::FormValidator with Moose types and added sugar

VERSION 0.01

SYNOPSIS

  use MooseX::DFV;
  use Moose::Util::TypeConstraints;

  my $person_prof = profile (
      required => [qw/salary name/],
      constraints => {
          salary => {
              name => 'Salary',
              type =>  subtype as 'Int'
                       => where { $_ > 10000 },
          },
          name => {
             name => 'Full name',
             type => 'Str',
          },
      }
  );

  my $params = { salary => '20000', name => 'Jim Bob'};

  my $result = validate $params, against => $person_prof;

DESCRIPTION

This module allows you to use Moose type constraints with

EXPORT

profile

Declare a new DFV profile

 my $profile = profile ( required=>[qw/field1 field2/],
    constraints => {
        field1 => {..}
    },
 );

validate

Validate parameters against a profile

  my $result = validate $params, against => $profile_name;

SEE ALSO

Data::FormValidator Moose::Util::TypeConstraints MooseX::Types

REPOSITORY

 git://github.com/robinedwards/MooseX-DFV.git

AUTHOR

Rob Edwards, <robin.ge@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2010 by Rob Edwards

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.