[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] RFC: Data::FormValidator 4.0


What I find amazing is the whole closure thing. That was one of the things that was hanging me up - when writing customized constraint methods, it would have been nice to have access to some of the application data (database handles, mostly, if I recall correctly).

Thinking back -- let's say I wanted to constrain the email address by checking the database to see if it already exists or not:

sub _my_profile
{
  return
  {
    'constraints' =>
    {
      'email' => \&_check_email,
    },
  };
}

sub _check_email
{
  my ( $email );
  $email = shift;
  # now here's my problem ... now I have to create a db handle
  # when one already exists ... if I only had access to the cgiapp
  # $self instance.
}

- Jason

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


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.