Fix a forgotten nested try::tiny usage
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBI.pm
index ed2ab1b..c7f0ec8 100644 (file)
@@ -10,7 +10,6 @@ use mro 'c3';
 use Carp::Clan qw/^DBIx::Class|^Try::Tiny/;
 use DBI;
 use DBIx::Class::Storage::DBI::Cursor;
-use DBIx::Class::Storage::Statistics;
 use Scalar::Util qw/refaddr weaken reftype blessed/;
 use Data::Dumper::Concise 'Dumper';
 use Sub::Name 'subname';
@@ -171,9 +170,9 @@ sub new {
 
   sub _arm_global_destructor {
     my $self = shift;
-    my $key = Scalar::Util::refaddr ($self);
+    my $key = refaddr ($self);
     $seek_and_destroy{$key} = $self;
-    Scalar::Util::weaken ($seek_and_destroy{$key});
+    weaken ($seek_and_destroy{$key});
   }
 
   END {
@@ -1850,15 +1849,14 @@ sub _dbh_execute_inserts_with_no_binds {
   }
   catch {
     $err = shift;
+  };
+
+  # Make sure statement is finished even if there was an exception.
+  try {
+    $sth->finish
   }
-  finally {
-    # Make sure statement is finished even if there was an exception.
-    try {
-      $sth->finish
-    }
-    catch {
-      $err = shift unless defined $err;
-    };
+  catch {
+    $err = shift unless defined $err;
   };
 
   $self->throw_exception($err) if defined $err;