Permalink
Browse files

Update t/751msaccess.t broken by leak checker 65d3512

Can't have the cleanup sub close over $schema.
  • Loading branch information...
1 parent 19b088d commit 2d48959ab73f3f9a60cbcf42e115a1b724cb45cd @rkitover rkitover committed with ribasushi Mar 12, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 t/751msaccess.t
View
8 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;

0 comments on commit 2d48959

Please sign in to comment.