X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FCursor.pm;h=92e870201d44a1b3683629a3b6a83bfc15d4d488;hb=4bea1fe7a2b4827947b3d0d64b16a0f2c5e594bd;hp=c4c9806ba85b1bdfad438eb4b3784063720bcde4;hpb=b4ad6d390ea8a1557b047f311d00b49a283b0b82;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 c4c9806..92e8702 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -3,14 +3,13 @@ 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/ + qw/sth storage args pos attrs _dbh_gen/ ); =head1 NAME @@ -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 { @@ -177,11 +177,10 @@ sub _check_dbh_gen { } 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} }; + if (my $sth = $_[0]->sth) { + try { $sth->finish } if $sth->FETCH('Active'); + } } 1;