use namespace::cleaned out imports for some common utilities
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI / Pg.pm
index 4428b1f..5814b71 100644 (file)
@@ -10,7 +10,8 @@ use mro 'c3';
 
 use DBD::Pg qw(:pg_types);
 use Scope::Guard ();
-use Context::Preserve ();
+use Context::Preserve 'preserve_context';
+use namespace::clean;
 
 # Ask for a DBD::Pg with array support
 warn __PACKAGE__.": DBD::Pg 2.9.2 or greater is strongly recommended\n"
@@ -36,8 +37,7 @@ sub with_deferred_fk_checks {
     $self->_do_query('SET CONSTRAINTS ALL IMMEDIATE');
   });
 
-  return Context::Preserve::preserve_context(sub { $sub->() },
-    after => sub { $txn_scope_guard->commit });
+  return preserve_context { $sub->() } after => sub { $txn_scope_guard->commit };
 }
 
 # only used when INSERT ... RETURNING is disabled