Skip Menu |

This queue is for tickets about the Data-FormValidator CPAN distribution.

Maintainer(s)' notes

This is the bug queue for Data::FormValidator.

Report information
The Basics
Id: 18236
Status: rejected
Priority: 0/
Queue: Data-FormValidator

People
Owner: MARKSTOS [...] cpan.org
Requestors: kevin [...] theconfused.co.uk
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 4.14
Fixed in: (no value)



Subject: _arrayify will return an empty array for an emtpy string value
The following line occurs in Class::DBI::FromForm: $them->$col( $results->valid($col)); If the value of the column is '', which will occur when the column needs to be cleared, then, because the result should be in an array context, valid will return () in stead of the expected ( '' ). Not sure if this is working as intended or a bug. I changed _arrayify to simply return an ( $val ) if $val isn't an array ref and the problem vanished. Kevin
Subject: Re: [rt.cpan.org #18236] _arrayify will return an empty array for an emtpy string value
Date: Mon, 20 Mar 2006 09:59:36 -0500
To: Guest via RT <bug-Data-FormValidator [...] rt.cpan.org>
From: Mark Stosberg <mark [...] summersault.com>
On Sat, Mar 18, 2006 at 08:08:53PM -0500, Guest via RT wrote: Show quoted text
> > Sat Mar 18 20:08:53 2006: Request 18236 was acted upon. > Transaction: Ticket created by guest > Queue: Data-FormValidator > Subject: _arrayify will return an empty array for an emtpy string value > Owner: Nobody > Requestors: kevin@theconfused.co.uk > Status: new > Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=18236 > > > > The following line occurs in Class::DBI::FromForm: > > $them->$col( $results->valid($col)); > > If the value of the column is '', which will occur when the column needs > to be cleared, then, because the result should be in an array context, > valid will return () in stead of the expected ( '' ). > > Not sure if this is working as intended or a bug.
Kevn, to clarify this, please create a new test case for the DFV test suite. DFV also have global filters, which would treat '' as blank, and turn it into 'undef'. Your test will clarify the behavior. Also, cross reference to the docs for valid() to see if there is documentation for this case and if it is consistent. Mark
From: MARKSTOS [...] cpan.org
On Sat Mar 18 20:08:53 2006, guest wrote: Show quoted text
> The following line occurs in Class::DBI::FromForm: > > $them->$col( $results->valid($col)); > > If the value of the column is '', which will occur when the column needs > to be cleared, then, because the result should be in an array context, > valid will return () in stead of the expected ( '' ). > > Not sure if this is working as intended or a bug. > > I changed _arrayify to simply return an ( $val ) if $val isn't an array > ref and the problem vanished.
I'm closing this bug as "WONTFIX" for now. I think it's reasonable that '' gets translated to into an empty list or undef. Even for the "use case" you supply, it's reasonable to use 'undef' rather than '' to clear out a field. Perhaps you are getting bitten by list context versus scalar context? Try this with the original code: $them->$col( scalar $results->valid($col)); My guess is that might return "undef" rather than an empty list and possibly solve your problem. I think the current behavior is reasonable and likely bring /other/ software change it. If you feel strongly the change should be made, petition the DFV users list and get some other opinions on the issue. Mark