The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Test::mysqld::Pool - create a pool of Test::mysqld-s

SYNOPSIS

  use DBI;
  use Test::mysqld::Pool;

  my $pool = Test::mysqld::Pool->new(
    my_cnf => {
      'skip-networking' => '', # no TCP socket
    },
    jobs   => 2,
  ) or plan skip_all => $Test::mysqld::errstr;

  my $dsn1 = $pool->alloc; # in process 1
  my $dsn2 = $pool->alloc; # in process 2
  # my $dsn3 = $pool->alloc; # blocks

  # after process 1 death
  $pool->dealloc_unused;

  my $dsn3 = $pool->alloc; # in process 3 (get dsn from pool; reused $dsn of process 1)