Skip Menu |

This queue is for tickets about the DBIx-Class-Validation CPAN distribution.

Report information
The Basics
Id: 61886
Status: open
Priority: 0/
Queue: DBIx-Class-Validation

People
Owner: Nobody in particular
Requestors: glenn_aycock [...] hotmail.com
Cc:
AdminCc:

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



Subject: validate() croaks if not successful
Unless I have misunderstood the examples, this seems to be incorrect application behavior. Line 185 of Validation.pm croaks if the validation result is not successful. If data validation fails, shouldn't it still return a result for the programmer to deal with, instead of dying? Running ::Validation version 0.02005 on PERL 5.12.1
On Mon Oct 04 15:37:13 2010, glenn_aycock wrote: Show quoted text
> Unless I have misunderstood the examples, this seems to be incorrect > application behavior. Line 185 of Validation.pm croaks if the
validation Show quoted text
> result is not successful. If data validation fails, shouldn't it
still Show quoted text
> return a result for the programmer to deal with, instead of dying?
Not only does it croak, but it croaks with the result set as the argument. I'd hate to have to do something like this in my unit tests: sub email_required { my $user = # create instance... my $result = validate($user); #check result } sub validate { my $obj = shift; my $result; eval { $result = $obj->validate }; $result = $@ if $@; return $result; }
On Fri Feb 04 20:35:30 2011, SHAW wrote: Show quoted text
> On Mon Oct 04 15:37:13 2010, glenn_aycock wrote:
> > Unless I have misunderstood the examples, this seems to be incorrect > > application behavior. Line 185 of Validation.pm croaks if the
> validation
> > result is not successful. If data validation fails, shouldn't it
> still
> > return a result for the programmer to deal with, instead of dying?
> > Not only does it croak, but it croaks with the result set as the > argument.
Upon further inspection, I think this is done to work with DBIx::Class::Row::(insert,update).