DBIx-Class-Schema-Loader-DBI-MariaDB

 view release on metacpan or  search on metacpan

t/lib/dbixcsl_test_dir.pm  view on Meta::CPAN

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 
use strict;
use File::Path 'rmtree';
use File::Temp 'tempdir';
use Scalar::Util 'weaken';
use DBI ();
 
our @EXPORT_OK = '$tdir';
 
die "/t does not exist, this can't be right...\n"
    unless -d 't';
 
my $tbdir = 't/var';

t/lib/dbixcsl_test_dir.pm  view on Meta::CPAN

28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
no warnings 'redefine';
 
my $connect = \&DBI::connect;
 
my @handles;
 
*DBI::connect = sub {
    my $dbh = $connect->(@_);
    push @handles, $dbh;
    weaken $handles[-1];
    return $dbh;
};
 
END {
    if (not $ENV{SCHEMA_LOADER_TESTS_NOCLEANUP}) {
        foreach my $dbh (@handles) {
            $dbh->disconnect if $dbh;
        }
 
        rmtree($tdir, 1, 1);



( run in 0.239 second using v1.01-cache-2.11-cpan-26ccb49234f )