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: 9860
Status: resolved
Priority: 0/
Queue: Data-FormValidator

People
Owner: MARKSTOS [...] cpan.org
Requestors: millerp [...] caribdata.co.uk
Cc:
AdminCc:

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



Subject: missing_optional_valid profile flag does nothing.
The missing_optional_valid does not place missing optional fields in the valid hash. This appears to be because the %data hash is iterated, and naturally the missing optionals are not there. I enclose a patch that produces the output that I expect by iterating the %optional hash, checking only for the flag and the lack of a %data entry. Wonderful module by the way - I'd be lost or late without it. Regards Paul Miller
*** Results.pm Tue Jan 18 10:47:27 2005 --- Results.pm.1 Tue Jan 18 10:49:19 2005 *************** *** 387,394 **** } # add back in missing optional fields from the data hash if we need to ! foreach my $field ( keys %data ) { ! if ($profile->{missing_optional_valid} and $optional{$field} and (not exists $valid{$field})) { $valid{$field} = undef; } } --- 387,394 ---- } # add back in missing optional fields from the data hash if we need to ! foreach my $field ( keys %optional ) { ! if ($profile->{missing_optional_valid} and (not exists $data{$field})) { $valid{$field} = undef; } }
Date: Tue, 18 Jan 2005 09:31:35 -0500
From: Mark Stosberg <mark [...] summersault.com>
To: Guest via RT <bug-Data-FormValidator [...] rt.cpan.org>
Subject: Re: [cpan #9860] missing_optional_valid profile flag does nothing.
RT-Send-Cc:
On Tue, Jan 18, 2005 at 05:57:08AM -0500, Guest via RT wrote: Show quoted text
> > This message about Data-FormValidator was sent to you by guest <> via rt.cpan.org > > Full context and any attached attachments can be found at: > <URL: https://rt.cpan.org/Ticket/Display.html?id=9860 > > > The missing_optional_valid does not place missing optional fields in > the valid hash. This appears to be because the %data hash is iterated, > and naturally the missing optionals are not there. > > I enclose a patch that produces the output that I expect by iterating > the %optional hash, checking only for the flag and the lack of a %data > entry.
Paul, Thanks for the bug report. I find it surprising, because we have tests for this feature in: t/07_missing_optional.t (in the distribution) Please add a new test to this test suite that fails without your patch, and succeeds with it. Then I'll be convinced there's a bug. :) Mark
Show quoted text
> Paul, > > Thanks for the bug report. > > I find it surprising, because we have tests for this feature in: > > t/07_missing_optional.t > > (in the distribution) > > Please add a new test to this test suite that fails without your > patch, > and succeeds with it. > > Then I'll be convinced there's a bug. :) > > Mark
Mark, It may be that I am misunderstanding the feature. I expected the missing_optional_valid to add all elements in the 'optional' array to the 'valid' array and as keys in the 'valid' hash even if they are missing. It looks to me like this functionality is actually provided by the 'default' array. It still means that the missing_optional_valid flag does nothing, but at least the functionality I need is present. Regards Paul
Date: Tue, 18 Jan 2005 11:47:31 -0500
From: Mark Stosberg <mark [...] summersault.com>
To: Guest via RT <bug-Data-FormValidator [...] rt.cpan.org>
Subject: Re: [cpan #9860] missing_optional_valid profile flag does nothing.
RT-Send-Cc:
On Tue, Jan 18, 2005 at 11:40:42AM -0500, Guest via RT wrote: Show quoted text
> > > It may be that I am misunderstanding the feature. I expected the missing_optional_valid to > add all elements in the 'optional' array to the 'valid' array and as keys in the 'valid' hash even > if they are missing. It looks to me like this functionality is actually provided by the 'default' > array. It still means that the missing_optional_valid flag does nothing
I'm not convinced of that, I use it frequently. In the tests I references, the default system is not used at all, although the profile involved is named default. Show quoted text
>, but at least the functionality I need is present.
Good to hear. I'm still interested in a test case that illustrates that bug you describe. Mark