X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FCursor.pm;h=eee5cbbb2232e6495da5ac84a9d26585cafee26e;hb=380b6ea1587b75b618c597feb277297afbc3bacf;hp=875a3cb1bbc298112f6d49b63c2553e96466895e;hpb=48a76fcfd023d2149f6980bd9a7bdc4937dbc4fc;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index 875a3cb..eee5cbb 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -5,6 +5,9 @@ use warnings; use base qw/DBIx::Class::Cursor/; +use Try::Tiny; +use namespace::clean; + __PACKAGE__->mk_group_accessors('simple' => qw/sth/ ); @@ -150,7 +153,8 @@ 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; } @@ -173,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;