X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F751msaccess.t;h=48ff756001f7ad072795f75254b8a8502eb6c937;hb=66137dffe1bc1763bbdf72223bbb9e0214e3051e;hp=403dc21912d3a41060b6747acf4774ba0b581d4b;hpb=199fbc453ec03891d0e156d7353c5e992ba4de47;p=dbsrgits%2FDBIx-Class.git diff --git a/t/751msaccess.t b/t/751msaccess.t index 403dc21..48ff756 100644 --- a/t/751msaccess.t +++ b/t/751msaccess.t @@ -42,15 +42,13 @@ my @info = ( [ $dsn2, $user2 || '', $pass2 || '' ], ); -my $schema; - foreach my $info (@info) { my ($dsn, $user, $pass) = @$info; next unless $dsn; # Check that we can connect without any options. - $schema = DBICTest::Schema->connect($dsn, $user, $pass); + my $schema = DBICTest::Schema->connect($dsn, $user, $pass); lives_ok { $schema->storage->ensure_connected; } 'connection without any options'; @@ -66,7 +64,7 @@ foreach my $info (@info) { LongReadLen => $maxloblen, }); - my $guard = Scope::Guard->new(\&cleanup); + my $guard = Scope::Guard->new(sub { cleanup($schema) }); my $dbh = $schema->storage->dbh; @@ -442,6 +440,8 @@ SQL done_testing; sub cleanup { + my $schema = shift; + if (my $storage = eval { $schema->storage }) { # cannot drop a table if it has been used, have to reconnect first $schema->storage->disconnect;