X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FCursor.pm;h=a73eb52f0931b712d11afa907a2e85f15b285fd0;hb=9e34d55419481925691c7177d43ba48ec02b02eb;hp=d1f1c6e21390368beaa5590f609908b768e9725d;hpb=2e0afecf16ef72b926cd2670a42285da30ffa9f9;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index d1f1c6e..a73eb52 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -3,11 +3,10 @@ package DBIx::Class::Storage::DBI::Cursor; use strict; use warnings; -use base qw/ - Class::Accessor::Grouped - DBIx::Class::Cursor -/; -use mro 'c3'; +use base qw/DBIx::Class::Cursor/; + +use Try::Tiny; +use namespace::clean; __PACKAGE__->mk_group_accessors('simple' => qw/sth/ @@ -128,7 +127,7 @@ sub _dbh_all { my ($storage, $dbh, $self) = @_; $self->_check_dbh_gen; - $self->sth->finish if $self->sth->{Active}; + $self->sth->finish if $self->sth && $self->sth->{Active}; $self->sth(undef); my ($rv, $sth) = $storage->_select(@{$self->{args}}); return @{$sth->fetchall_arrayref}; @@ -154,8 +153,10 @@ sub reset { my ($self) = @_; # No need to care about failures here - eval { $self->sth->finish if $self->sth && $self->sth->{Active} }; + try { $self->sth->finish } + if $self->sth && $self->sth->{Active}; $self->_soft_reset; + return undef; } sub _soft_reset { @@ -164,7 +165,6 @@ sub _soft_reset { $self->sth(undef); delete $self->{done}; $self->{pos} = 0; - return $self; } sub _check_dbh_gen { @@ -180,8 +180,8 @@ sub DESTROY { my ($self) = @_; # None of the reasons this would die matter if we're in DESTROY anyways - local $@; - eval { $self->sth->finish if $self->sth && $self->sth->{Active} }; + try { $self->sth->finish } + if $self->sth && $self->sth->{Active}; } 1;