$dbh = DBI->connect(@connect) or die DBI->errstr;
my @table;
-END { $dbh->do("DROP TABLE $_") foreach @table }
+END {
+ $dbh->do("DROP TABLE $_") for @table;
+ undef $dbh;
+}
__PACKAGE__->connection(@connect);
# clean up our mess
END {
- if($schema && (my $dbh = $schema->storage->dbh)) {
+ if($schema && (my $dbh = $schema->storage->_dbh)) {
$dbh->do("DROP TABLE event");
}
undef $schema;
}
END {
+ # Make sure we run after any cleanup in other END blocks
+ require B;
+ push @{ B::end_av()->object_2svref }, sub {
assert_empty_weakregistry($weak_registry, 'quiet');
+ };
}
=head2 deploy_schema
}
END {
- assert_empty_weakregistry($weak_registry, 'quiet');
+ # Make sure we run after any cleanup in other END blocks
+ require B;
+ push @{ B::end_av()->object_2svref }, sub {
+ assert_empty_weakregistry($weak_registry, 'quiet');
+ };
}
1;