True - my logic was there was no point in printing two errors - if the passwords
didn't match then the fact that they weren't over 6 characters was irrelevant,
but your suggestion is nicer

Dan
Quoting Drew Taylor <[EMAIL PROTECTED]>:

> On Tue, 12 Oct 2004 05:53:38 +1300, Dan Horne <[EMAIL PROTECTED]>
> wrote:
>
> > sub _user_profile{
> >     return {
> >         required => [qw(username password1 password2 first_name last_name
> >                      role_id acst_id site_id function)],
> >         optional => [qw(user_id)],
> >         constraints => {
> >             password1 => {
> >                 name => 'invalid_password1',
> >                 constraint => \&_check_pass,
> >                 params => ['password1']
> >             },
> >             password2 => {
> >                 name => 'invalid_password2',
> >                 constraint => \&_check_pass,
> >                 params => ['password2']
> >             },
> >             password1 => {
> >                 name => 'confirm',
> >                 constraint => sub {
> >                     my $password1 = shift;
> >                     my $password2 = shift;
> >                     return ($password1 eq $password2);
> >                 },
> >                 params => [qw(password1 password2)]
> >             },
> >         },
>
> In your example above the first 'password1' constraint is overwritten
> by the second 'password1' constraint, so the first is never run. You
> could consolidate some of your profile code by incorporating the
> &_check_pass code in the last constraint.
>
> Drew
> --
> ----------------------------------------------------------------
>  Drew Taylor                 *  Web development & consulting
>  Email: [EMAIL PROTECTED]  *  Site implementation & hosting
>  Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
>  ----------------------------------------------------------------
>
>

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[EMAIL PROTECTED]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to