X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FCursor.pm;h=75b1136b6411aa88d6c207f959b628ff30d542ba;hb=a359de728e5e749aaf3d550fceb023b808456340;hp=ef3ba307101052820c492158cab14dee6c532f1f;hpb=9780718f9c36738245f90b1f036998c3b076cffc;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index ef3ba30..75b1136 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -6,6 +6,7 @@ use warnings; use base qw/DBIx::Class::Cursor/; use Try::Tiny; +use namespace::clean; __PACKAGE__->mk_group_accessors('simple' => qw/sth/ @@ -152,7 +153,8 @@ sub reset { my ($self) = @_; # No need to care about failures here - try { $self->sth->finish if $self->sth && $self->sth->{Active} }; + try { $self->sth->finish } + if $self->sth && $self->sth->{Active}; $self->_soft_reset; return undef; } @@ -175,10 +177,10 @@ sub _check_dbh_gen { } sub DESTROY { - my ($self) = @_; - # None of the reasons this would die matter if we're in DESTROY anyways - try { $self->sth->finish if $self->sth && $self->sth->{Active} }; + if (my $sth = $_[0]->sth) { + try { $sth->finish } if $sth->{Active}; + } } 1;