[cgiapp] re: Data::FormValidator::Tutorial example

Mark Stosberg mark at summersault.com
Wed Jan 28 15:14:58 EST 2009


On Wed, 28 Jan 2009 01:59:00 +0000
Lyle <webmaster at cosmicperl.com> wrote:

> Lyle wrote:
> > Joshua Miller wrote:
> >>> Joshua,
> >>>  Have you managed to figure out a work around for:-
> >>>
> >>> 'constraints' => {
> >>>           'password1' => {
> >>>               'constraint' => "check_passwords",
> >>>               'params'     => [ qw( password1 password2 ) ],
> >>>             },
> >>>         },
> >>>  ...
> >>>  sub check_passwords {
> >>>   my ( $pw1, $pw2 ) = @_;
> >>>   if ( $pw1 eq $pw2 ) {
> >>>     return 1;
> >>>   } else {
> >>>     return 0;
> >>>   }
> >>>  }
> 
> I've just tried this code in DFV and I can't get it working? I'm getting 
> the error
> "No constraint found named 'must_match' at Data/FormValidator/Results.pm 
> line 965."
> 
> Can't seem to figure out what I'm missing...
> 
> Should be working according to the guide I followed at:-
> http://search.cpan.org/~purdy/Data-FormValidator-Tutorial-1.61/lib/Data/FormValidator/Tutorial.pm

You may need to post a code sample. Neither the sample above or the
tutorial contain the phrase "must_match".

I will note that the password example is outdated. A better way to do
the same thing is with "FV_eq_with":

http://search.cpan.org/~markstos/Data-FormValidator-4.63/lib/Data/FormValidator/Constraints.pm#FV_eq_with

I'm CC'ing the DFV::Tutorial author, who may wish to update the example. 

    Mark




More information about the cgiapp mailing list