X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest.pm;h=c0c91c276886cf8656f168764d96cec66c45e9a1;hb=5c505cafa292b25dbbfb0df53ac30e73069834a2;hp=ff046a7d3d1a4428713d5d8d5a95bcba03f3dd12;hpb=630e2ea8a42ab04c12effadf75e11b5081334899;p=dbsrgits%2FDBIx-Class.git diff --git a/t/lib/DBICTest.pm b/t/lib/DBICTest.pm index ff046a7..c0c91c2 100644 --- a/t/lib/DBICTest.pm +++ b/t/lib/DBICTest.pm @@ -7,13 +7,12 @@ use warnings; use DBICTest::Util qw( local_umask await_flock dbg DEBUG_TEST_CONCURRENCY_LOCKS ); use DBICTest::Schema; use DBICTest::Util::LeakTracer qw/populate_weakregistry assert_empty_weakregistry/; -use DBIx::Class::_Util 'detected_reinvoked_destructor'; +use DBIx::Class::_Util qw( detected_reinvoked_destructor scope_guard ); use Carp; use Path::Class::File (); use File::Spec; use Fcntl qw/:DEFAULT :flock/; use Config; -use Scope::Guard (); =head1 NAME @@ -284,6 +283,7 @@ sub __mk_disconnect_guard { return; } elsif ($event eq 'disconnect') { + return unless $connected; # we already disconnected earlier $connected = 0; } elsif ($event eq 'DESTROY' and ! $connected ) { @@ -405,7 +405,7 @@ sub deploy_schema { my $guard; if ( ($ENV{TRAVIS}||'') eq 'true' and my $old_dbg = $schema->storage->debug ) { - $guard = Scope::Guard->new(sub { $schema->storage->debug($old_dbg) }); + $guard = scope_guard { $schema->storage->debug($old_dbg) }; $schema->storage->debug(0); } @@ -439,7 +439,7 @@ sub populate_schema { my $guard; if ( ($ENV{TRAVIS}||'') eq 'true' and my $old_dbg = $schema->storage->debug ) { - $guard = Scope::Guard->new(sub { $schema->storage->debug($old_dbg) }); + $guard = scope_guard { $schema->storage->debug($old_dbg) }; $schema->storage->debug(0); }