![]() |
![]()
| ![]() |
![]()
NAMETest::postgresql - postgresql runner for tests SYNOPSISuse DBI; use Test::postgresql; use Test::More; my $pgsql = Test::postgresql->new() or plan skip_all => $Test::postgresql::errstr; plan tests => XXX; my $dbh = DBI->connect($pgsql->dsn); DESCRIPTION"Test::postgresql" automatically setups a postgresql instance in a temporary directory, and destroys it when the perl script exits. FUNCTIONSnewCreate and run a postgresql instance. The instance is terminated when the returned object is being DESTROYed. If required programs (initdb and postmaster) were not found, the function returns undef and sets appropriate message to $Test::postgresql::errstr. base_dirReturns directory under which the postgresql 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. initdbpostmasterPath to "initdb" and "postmaster" which are part of the postgresql distribution. If not set, the programs are automatically searched by looking up $PATH and other prefixed directories. initdb_argspostmaster_argsArguments passed to "initdb" and "postmaster". Following example adds --encoding=utf8 option to "initdb_args". my $pgsql = Test::postgresql->new( initdb_args => $Test::postgresql::Defaults{initdb_args} . ' --encoding=utf8' ) or plan skip_all => $Test::postgresql::errstr; dsnBuilds and returns dsn by using given parameters (if any). Default username is 'postgres', and dbname is 'test' (an empty database). pidReturns process id of postgresql (or undef if not running). portReturns TCP port number on which postmaster is accepting connections (or undef if not running). startStarts postmaster. stopStops postmaster. setupSetups the postgresql instance. AUTHORKazuho Oku THANKS TOHSW COPYRIGHTCopyright (C) 2009 Cybozu Labs, Inc. 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>
|