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: 54846
Status: resolved
Priority: 0/
Queue: HTML-FormHandler

People
Owner: Nobody in particular
Requestors: evdb [...] ecclestoad.co.uk
Cc:
AdminCc:

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



Subject: producing warnings in 'check' sub leads to check failing.
Date: Sun, 21 Feb 2010 15:41:41 -0300
To: bug-HTML-FormHandler <bug-HTML-FormHandler [...] rt.cpan.org>
From: Edmund von der Burg <evdb [...] ecclestoad.co.uk>
An example has_field 'test' => ( type => 'Text', label => 'Test', apply => [ { check => sub { warn "warning produced"; return 1; }, message => 'check returns true - this message should not be seen', }, ] ); This check will always fail - but comment out the warning and it passes. Not being able to emit warnings in the validation code makes it difficult to debug. Cheers, Edmund. -- Who will you vote for? http://www.YourNextMP.com
FormHandler needs to trap warnings in HTML::FormHandler::Validate::Actions::_apply_actions because there are some commonly used validation packages which use 'warn' to indicate an error. I suggest that you use either a 'print' statement or DB::single=1; and step through it with the debugger. It's also easier to test your forms and fields if you use tests such as are found in the FormHandler distribution 't' directory.