Modified: trunk/patches/DBIx-Class-Validation/01-DBIx-Class-Exception.patch
===================================================================
--- trunk/patches/DBIx-Class-Validation/01-DBIx-Class-Exception.patch 2012-07-19 17:01:39 UTC (rev 702)
+++ trunk/patches/DBIx-Class-Validation/01-DBIx-Class-Exception.patch 2012-07-20 09:25:34 UTC (rev 703)
@@ -1,107 +1,107 @@
-diff -ur DBIx-Class-Validation-0.02005.original/lib/DBIx/Class/Validation.pm DBIx-Class-Validation-0.02005/lib/DBIx/Class/Validation.pm
---- DBIx-Class-Validation-0.02005.original/lib/DBIx/Class/Validation.pm 2009-07-11 15:20:55.000000000 +0000
-+++ DBIx-Class-Validation-0.02005/lib/DBIx/Class/Validation.pm 2010-05-13 00:46:18.000000000 +0000
-@@ -1,4 +1,14 @@
- # $Id$
-+package DBIx::Class::Validation::Exception;
-+use overload bool => sub { $_[0]->success ? '' : 1 };
-+use overload ne => sub { $_[0]->success ? '' : "Error" };
-+use overload eq => sub { ! $_[0]->success ? '' : "Error" };
-+sub new {
-+ my ($class, $validator_class, $result) = @_;
-+ push @ISA, $validator_class."::Results";
-+ bless $result, $class
-+}
-+
- package DBIx::Class::Validation;
- use strict;
- use warnings;
-@@ -161,7 +171,9 @@
- Validates all the data in the object against the pre-defined validation
- module and profile. If there is a problem then a hard error will be
- thrown. If you put the validation in an eval you can capture whatever
--the module's check() method returned.
-+the module's check() method returned in $@. $@ will have its boolean
-+check overloaded to "" on success (for normal exception checking after
-+an eval)
-
- =cut
-
-@@ -182,7 +194,8 @@
- };
- return $result;
- } else {
-- croak $result;
-+ my $exception = DBIx::Class::Validation::Exception->new( ref $self-> _validation_module_accessor, $result );
-+ croak $exception;
- };
- };
-
-diff -ur DBIx-Class-Validation-0.02005.original/t/dfv.t DBIx-Class-Validation-0.02005/t/dfv.t
---- DBIx-Class-Validation-0.02005.original/t/dfv.t 2009-07-11 14:41:25.000000000 +0000
-+++ DBIx-Class-Validation-0.02005/t/dfv.t 2010-05-13 00:46:36.000000000 +0000
-@@ -10,7 +10,7 @@
- plan skip_all => 'Data::FormValidator not installed'
- unless eval 'require Data::FormValidator';
-
-- plan tests => 10;
-+ plan tests => 15;
- };
-
- use Data::FormValidator::Constraints qw(:closures);
-@@ -87,16 +87,23 @@
-
- ## Create a new row with a new email.
-
-- my $new_email_rs = $schema->resultset('Test')->create({name => 'testA', email => '[email protected]', 'createts'=> $test_time});
-+ my $new_email_rs = eval { $schema->resultset('Test')->create({name => 'testA', email => '[email protected]', 'createts'=> $test_time}) };
-+ ok( !$@, "No exception found" );
-+ ok( $@ eq "", "No exception found (scalar context)" );
- is $new_email_rs->email, '[email protected]', 'Created a unique Email Address';
-
- my $bad_rs = eval{ $schema->resultset('Test')->create({name => 'testA', email => '[email protected]', 'createts'=> $test_time}) };
- isa_ok $@, 'Data::FormValidator::Results', 'Failed as expected';
-
-+ ok( $@, "Exception found" );
-+ ok( $@ ne "", "Exception found (ne context)" );
-+ ok( !( $@ eq "" ), "Exception found (eq context)" );
-+
- my @bad_fields = $@->invalid;
- my $errs_msgs = $@->invalid;
-
- ok($bad_fields[0] eq 'email', 'Invalid Field correctly identified');
- ok($errs_msgs->{email}->[0] eq 'email_not_unique', 'Invalid Field Message Found');
- ok($new_email_rs->createts->epoch == $test_time, "Correctly filtered inflated object");
--};
-\ No newline at end of file
-+
-+};
-diff -ur DBIx-Class-Validation-0.02005.original/t/fvs.t DBIx-Class-Validation-0.02005/t/fvs.t
---- DBIx-Class-Validation-0.02005.original/t/fvs.t 2009-07-11 14:48:18.000000000 +0000
-+++ DBIx-Class-Validation-0.02005/t/fvs.t 2010-05-13 00:46:12.000000000 +0000
-@@ -5,7 +5,7 @@
-
- BEGIN {
- use lib 't/lib';
-- use DBIC::Test tests => 17;
-+ use DBIC::Test tests => 21;
- }
-
- my $schema = DBIC::Test->init_schema;
-@@ -19,12 +19,16 @@
- Class::C3->reinitialize();
-
- $row = eval{ $schema->resultset('Test')->create({name => ''}) };
-+ok( $@, "Exception found" );
-+ok( $@ ne "", "Exception found (ne context)" );
-+ok( ! $@ eq "", "Exception found (eq context)" );
- isa_ok $@, 'FormValidator::Simple::Results', 'blank value not accepted';
-
- $row = eval{ $schema->resultset('Test')->create({name => 'qwertyqwerty'}) };
- isa_ok $@, 'FormValidator::Simple::Results', 'long string not accepted';
-
- $row = eval{ $schema->resultset('Test')->create({name => 'qwerty'}) };
-+ok( !$@, "No exception found" );
- is $row->name, 'qwerty', 'valid data accepted';
-
- # updates too
+diff -ur DBIx-Class-Validation-0.02005.original/lib/DBIx/Class/Validation.pm DBIx-Class-Validation-0.02005/lib/DBIx/Class/Validation.pm
+--- DBIx-Class-Validation-0.02005.original/lib/DBIx/Class/Validation.pm 2009-07-11 15:20:55.000000000 +0000
++++ DBIx-Class-Validation-0.02005/lib/DBIx/Class/Validation.pm 2010-05-13 00:46:18.000000000 +0000
+@@ -1,4 +1,14 @@
+ # $Id$
++package DBIx::Class::Validation::Exception;
++use overload bool => sub { $_[0]->success ? '' : 1 };
++use overload ne => sub { $_[0]->success ? '' : "Error" };
++use overload eq => sub { ! $_[0]->success ? '' : "Error" };
++sub new {
++ my ($class, $validator_class, $result) = @_;
++ push @ISA, $validator_class."::Results";
++ bless $result, $class
++}
++
+ package DBIx::Class::Validation;
+ use strict;
+ use warnings;
+@@ -161,7 +171,9 @@
+ Validates all the data in the object against the pre-defined validation
+ module and profile. If there is a problem then a hard error will be
+ thrown. If you put the validation in an eval you can capture whatever
+-the module's check() method returned.
++the module's check() method returned in $@. $@ will have its boolean
++check overloaded to "" on success (for normal exception checking after
++an eval)
+
+ =cut
+
+@@ -182,7 +194,8 @@
+ };
+ return $result;
+ } else {
+- croak $result;
++ my $exception = DBIx::Class::Validation::Exception->new( ref $self-> _validation_module_accessor, $result );
++ croak $exception;
+ };
+ };
+
+diff -ur DBIx-Class-Validation-0.02005.original/t/dfv.t DBIx-Class-Validation-0.02005/t/dfv.t
+--- DBIx-Class-Validation-0.02005.original/t/dfv.t 2009-07-11 14:41:25.000000000 +0000
++++ DBIx-Class-Validation-0.02005/t/dfv.t 2010-05-13 00:46:36.000000000 +0000
+@@ -10,7 +10,7 @@
+ plan skip_all => 'Data::FormValidator not installed'
+ unless eval 'require Data::FormValidator';
+
+- plan tests => 10;
++ plan tests => 15;
+ };
+
+ use Data::FormValidator::Constraints qw(:closures);
+@@ -87,16 +87,23 @@
+
+ ## Create a new row with a new email.
+
+- my $new_email_rs = $schema->resultset('Test')->create({name => 'testA', email => '[email protected]', 'createts'=> $test_time});
++ my $new_email_rs = eval { $schema->resultset('Test')->create({name => 'testA', email => '[email protected]', 'createts'=> $test_time}) };
++ ok( !$@, "No exception found" );
++ ok( $@ eq "", "No exception found (scalar context)" );
+ is $new_email_rs->email, '[email protected]', 'Created a unique Email Address';
+
+ my $bad_rs = eval{ $schema->resultset('Test')->create({name => 'testA', email => '[email protected]', 'createts'=> $test_time}) };
+ isa_ok $@, 'Data::FormValidator::Results', 'Failed as expected';
+
++ ok( $@, "Exception found" );
++ ok( $@ ne "", "Exception found (ne context)" );
++ ok( !( $@ eq "" ), "Exception found (eq context)" );
++
+ my @bad_fields = $@->invalid;
+ my $errs_msgs = $@->invalid;
+
+ ok($bad_fields[0] eq 'email', 'Invalid Field correctly identified');
+ ok($errs_msgs->{email}->[0] eq 'email_not_unique', 'Invalid Field Message Found');
+ ok($new_email_rs->createts->epoch == $test_time, "Correctly filtered inflated object");
+-};
+\ No newline at end of file
++
++};
+diff -ur DBIx-Class-Validation-0.02005.original/t/fvs.t DBIx-Class-Validation-0.02005/t/fvs.t
+--- DBIx-Class-Validation-0.02005.original/t/fvs.t 2009-07-11 14:48:18.000000000 +0000
++++ DBIx-Class-Validation-0.02005/t/fvs.t 2010-05-13 00:46:12.000000000 +0000
+@@ -5,7 +5,7 @@
+
+ BEGIN {
+ use lib 't/lib';
+- use DBIC::Test tests => 17;
++ use DBIC::Test tests => 21;
+ }
+
+ my $schema = DBIC::Test->init_schema;
+@@ -19,12 +19,16 @@
+ Class::C3->reinitialize();
+
+ $row = eval{ $schema->resultset('Test')->create({name => ''}) };
++ok( $@, "Exception found" );
++ok( $@ ne "", "Exception found (ne context)" );
++ok( ! $@ eq "", "Exception found (eq context)" );
+ isa_ok $@, 'FormValidator::Simple::Results', 'blank value not accepted';
+
+ $row = eval{ $schema->resultset('Test')->create({name => 'qwertyqwerty'}) };
+ isa_ok $@, 'FormValidator::Simple::Results', 'long string not accepted';
+
+ $row = eval{ $schema->resultset('Test')->create({name => 'qwerty'}) };
++ok( !$@, "No exception found" );
+ is $row->name, 'qwerty', 'valid data accepted';
+
+ # updates too