From: Matt S Trout Date: Thu, 29 Jun 2006 22:03:34 +0000 (+0000) Subject: fixup to txn_do to allow use as a classmethod X-Git-Tag: v0.07002~75^2~66 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f32eb113ef8eeecae466e2e950382bc4f7c5469d;p=dbsrgits%2FDBIx-Class.git fixup to txn_do to allow use as a classmethod --- diff --git a/Changes b/Changes index 0b309e5..7dc2d20 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,7 @@ Revision history for DBIx::Class + - fix Schema->txn_do to not fail as a classmethod + 0.06999_04 2006-06-29 20:18:47 - disable cdbi-t/02-Film.t warning tests under AS perl - fixups to MySQL tests (aka "work round mysql being retarded") diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 8c7eac1..7926e92 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -555,8 +555,6 @@ context and it will behave as expected. sub txn_do { my ($self, $coderef, @args) = @_; - ref $self or $self->throw_exception - ('Cannot execute txn_do as a class method'); ref $coderef eq 'CODE' or $self->throw_exception ('$coderef must be a CODE reference'); diff --git a/t/81transactions.t b/t/81transactions.t index 847963e..5434387 100644 --- a/t/81transactions.t +++ b/t/81transactions.t @@ -25,7 +25,7 @@ my $code = sub { eval { (ref $schema)->txn_do(sub{}); }; - like($@, qr/class method/, '$self parameter check ok'); + like($@, qr/storage/, "can't call txn_do without storage"); eval { $schema->txn_do(''); };