![]() |
![]()
| ![]() |
![]()
NAMETest::mysqld - mysqld runner for tests SYNOPSISuse DBI; use Test::mysqld; use Test::More; my $mysqld = Test::mysqld->new( my_cnf => { 'skip-networking' => '', # no TCP socket } ) or plan skip_all => $Test::mysqld::errstr; plan tests => XXX; my $dbh = DBI->connect( $mysqld->dsn(dbname => 'test'), ); # start_mysqlds is faster than calling Test::mysqld->new twice my @mysqlds = Test::mysqld->start_mysqlds( 2, my_cnf => { 'skip-networking' => '', # no TCP socket } ) or plan skip_all => $Test::mysqld::errstr; Test::mysqlds->stop_mysqlds(@mysqlds); DESCRIPTION"Test::mysqld" automatically setups a mysqld instance in a temporary directory, and destroys it when the perl script exits. FUNCTIONSnewCreate and run a mysqld instance. The instance is terminated when the returned object is being DESTROYed. If required programs (mysql_install_db and mysqld) were not found, the function returns undef and sets appropriate message to $Test::mysqld::errstr. base_dirReturns directory under which the mysqld instance is being created. The property can be set as a parameter of the "new" function, in which case the directory will not be removed at exit. copy_data_fromIf specified, uses a copy of the specified directory as the data directory of MySQL. "Mysql" database (which is used to store administrative information) is automatically created if necessary by invoking mysql_install_db. my_cnfA hash containing the list of name=value pairs to be written into my.cnf. The property can be set as a parameter of the "new" function. mysql_install_dbmysqldPath to "mysql_install_db" script or "mysqld" program bundled to the mysqld distribution. If not set, the program is automatically search by looking up $PATH and other prefixed directories. dsnBuilds and returns dsn by using given parameters (if any). Default username depends on a server version and a socket family. Default dbname is 'test'. pidReturns process id of mysqld (or undef if not running). startStarts mysqld. stopStops mysqld. setupSetups the mysqld instance. read_logReturns the contents of the mysqld log file. start_mysqldsCreate and run some mysqld instances, and return a list of "Test::mysqld". stop_mysqldsStop some mysqld instances. COPYRIGHTCopyright (C) 2009 Cybozu Labs, Inc. Written by Kazuho Oku. LICENSEThis program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html>
|