9 my $schema = DBICTest->init_schema();
10 my $storage = $schema->storage;
12 $storage = $storage->master
13 if $ENV{DBICTEST_VIA_REPLICATED};
17 for my $disconnect (0, 1) {
18 $schema->storage->_dbh->disconnect if $disconnect;
20 $schema->storage->dbh_do(sub { $_[1]->selectall_arrayref('SELECT 1') }),
22 'dbh_do on fresh handle worked',
27 my $test_func = sub { @args = @_ };
29 $storage->dbh_do($test_func, "foo", "bar");
32 [ $storage, $storage->dbh, "foo", "bar" ],
36 my $storage_class = ref $storage;
39 local *{$storage_class .'::__test_method'} = $test_func;
40 $storage->dbh_do("__test_method", "baz", "buz");
45 [ $storage, $storage->dbh, "baz", "buz" ],
48 # test nested aliasing
50 $schema->storage->dbh_do (sub {
51 shift->dbh_do(sub { $_[3] = 'changed' }, @_)
54 is ($res, 'changed', "Arguments properly aliased for dbh_do");