Skip to content

Commit

Permalink
GAH! DBD::SQLite's sqlite_db_filename() is relatively new, undo 9e75be9
Browse files Browse the repository at this point in the history
On the bright side, re-trapping $db_file now *SEEMS TO WORK*. What the hell?
Ripping out the dogE-crap of 9e75be9, and trying to forget all of this ever
happened...
  • Loading branch information
ribasushi committed Jan 23, 2014
1 parent 2525160 commit e1ff35c
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 20 deletions.
7 changes: 0 additions & 7 deletions t/52leaks.t
Expand Up @@ -360,13 +360,6 @@ unless (DBICTest::RunMode->is_plain) {
## anything we have seen so far is cool
#delete @{$interim_wr}{keys %$weak_registry};
#
## I still don't get any of this...
#delete $interim_wr->{$_} for grep {
# ref ($interim_wr->{$_}{weakref}) eq 'SCALAR'
# and
# ${$interim_wr->{$_}{weakref}} eq 'very closure... much wtf... wow!!!'
#} keys %$interim_wr;
#
## moment of truth - the rest ought to be gone
#assert_empty_weakregistry($interim_wr);
}
Expand Down
13 changes: 1 addition & 12 deletions t/lib/DBICTest.pm
Expand Up @@ -210,23 +210,12 @@ sub _database {
);
}

# MASSIVE FIXME - this seems necessary, but I do not yet know why
# without an external variable on the pad the on_connect_do cref
# (starting just below) is being considered a const of some sorts
# and persists indefinitely... wtf --ribasushi
my $such_var = 'very closure... much wtf... wow!!!';

return ("dbi:SQLite:${db_file}", '', '', {
AutoCommit => 1,

# this is executed on every connect, and thus installs a disconnect/DESTROY
# guard for every new $dbh
on_connect_do => sub {
# MASSIVE FIXME - this seems necessary, but I do not yet know why
# without an external variable on the pad the on_connect_do cref
# (starting just above) is being considered a const of some sorts
# and persists indefinitely... wtf --ribasushi
$such_var if 0;

my $storage = shift;
my $dbh = $storage->_get_dbh;
Expand All @@ -246,7 +235,7 @@ sub _database {
# set a *DBI* disconnect callback, to make sure the physical SQLite
# file is still there (i.e. the test does not attempt to delete
# an open database, which fails on Win32)
if (my $guard_cb = __mk_disconnect_guard($dbh->sqlite_db_filename)) {
if (my $guard_cb = __mk_disconnect_guard($db_file)) {
$dbh->{Callbacks} = {
connect => sub { $guard_cb->('connect') },
disconnect => sub { $guard_cb->('disconnect') },
Expand Down
2 changes: 1 addition & 1 deletion t/storage/replicated.t
Expand Up @@ -208,6 +208,7 @@ TESTSCHEMACLASSES: {

sub cleanup {
my $self = shift @_;
$_->disconnect for values %{ $self->schema->storage->replicants };
foreach my $slave (@{$self->slave_paths}) {
if(-e $slave) {
unlink $slave;
Expand Down Expand Up @@ -914,7 +915,6 @@ is $debug{storage_type}, 'REPLICANT', "got last query from a replicant: $debug{d
}

## Delete the old database files
$_->disconnect for values %{ $replicated->schema->storage->replicants };
$replicated->cleanup;

done_testing;
Expand Down

0 comments on commit e1ff35c

Please sign in to comment.