Re: Problem with Class::DBI::FromForm & Data::FormValidator

[prev] [thread] [next] [Date index for 2005/06/20]

From: Andy Grundman
Subject: Re: Problem with Class::DBI::FromForm & Data::FormValidator
Date: 20:19 on 20 Jun 2005
Drew Taylor wrote:
> (Crossposted to CDBI and DFV lists in the hope that someone has an answer)
> 
> I'm trying to use Class::DBI::FromForm with a new application and am 
> running into consistent problems with the output from 
> D::FV::Results::valid().  The problem arises in 
> C::DBI::FromForm::_run_update(), specifically ~line 73:
> 
>   my $val = $results->valid($col);
> 
> According to the docs, valid() returns a scalar in scalar context and an 
> array in list context. The problem is that the scalar value being 
> returned is an array ref with a single value instead of the expected 
> scalar. This obviously causes problems when update() is called on my 
> CDBI object.

This looks like it might be a DFV bug or bug in your application.  I've 
never had any problems using FromForm 0.03 with DFV (in Catalyst). 
Every time I've needed to dump out the DFV results, they look like your 
first Dumper example (a hashref).  I've never seen it output arrayrefs 
like in your second example.

It doesn't look like your app does this, but FYI FromForm is not 
designed to be used if you have multiple values for any parameters 
(where valid would return an arrayref).  If your app requires this, 
you'll have to manually handle the multiple values in whatever way your 
app uses them.

-Andy

Re: Problem with Class::DBI::FromForm & Data::FormValidator
Andy Grundman 20:19 on 20 Jun 2005

Generated at 16:35 on 28 Jul 2005 by mariachi v0.52