Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the HTML-FormHandler CPAN distribution.

Report information
The Basics
Id: 68806
Status: resolved
Priority: 0/
Queue: HTML-FormHandler

Owner: Nobody in particular
Requestors: stephen.thirlwall [...]

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

Subject: Date fields broken when creating DBIC form with new result
Download (untitled) / with headers
text/plain 982b
Hello, I believe I have discovered a bug in To reproduce: * create a HTML::FormHandler::Model::DBIC form with a Date field. * create a new database row with $row = $resultset->new_result( {} ); * process the form as: $form->process( item => $row ); Dies with: Can't call method "value" on an undefined value at html-formhandler/lib/HTML/FormHandler/ line 740 Same code worked in 0.34000 and before. Works if a DateTime field is used instead of a Date field. The problem was introduced in this revision: Although I think that change merely exposed an existing problem. I will attach some test code and a possible fix shortly. Version information: HTML-FormHandler-0.34001 This is perl 5, version 12, subversion 2 (v5.12.2) built for x86_64-linux-thread-multi Debian 5 2.6.32-4-pve #1 SMP Mon May 9 12:59:57 CEST 2011 x86_64 GNU/Linux
From: stephen.thirlwall [...]
Download (untitled) / with headers
text/plain 1.2k
I've created a two related pull requests on github The first contains test code which exercises the problem: I've created t/Date.t which contains three tests. The first two work as expected, the third triggers the bug in question. I've added similar tests to t/DateTime.t to show the same code works for DateTime fields. The second contains a possible fix: I really cannot explain what is happening here. I arrived at this fix by comparing Field/ and Field/ The only real difference I could see was that wasn't defaulting the $value parameter to $self-value. I tried removing that line from Field/ and this seems to have fixed it. The place where the code dies is in, line 740 sub value { my $self = shift; # allow testing fields individually by creating result if no form return undef unless $self->has_result || !$self->form; my $result = $self->result; return $result->_set_value(@_) if @_; return $result->value; } I'm not 100% certain of what is going on, but it seems $self->has_result returns true, but $self->result is undef. Thanks, Stephen Thirlwall
Thanks for the report. This bug is fixed (in a couple of ways) in the upcoming release.

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to