Subject: | [patch] use Test::Database for mysql data |
Patch assumes that if mysql data is available, user want to run mysql tests.
--
Alexandr Ciornii, http://chorny.net
Subject: | Build.PL.patch |
--- Build.PL.dist 2012-06-17 22:58:48.000000000 +0300
+++ Build.PL 2013-01-05 14:21:44.531250000 +0200
@@ -84,9 +84,13 @@
}
}
+my $mysql_testdb = eval { require Test::Database;my @db_handles = Test::Database->handles('mysql');$db_handles[0] };
if ( $build->features( 'mysql_engine' ) ) {
- if ( $build->y_n( "Run the tests against the DBI engine via MySQL?", 'n' ) ) {
+ if ( $mysql_testdb or $build->y_n( "Run the tests against the DBI engine via MySQL?", 'n' ) ) {
my ($dsn, $user, $pass) = ('') x 3;
+ if ($mysql_testdb) {
+ ($dsn, $user, $pass) = ($mysql_testdb->dsn(), $mysql_testdb->username(), $mysql_testdb->password());
+ } else {
$dsn = $build->prompt( "\tWhat is the full DSN (for example 'dbi:mysql:test')" );
if ( $dsn ) {
$user = $build->prompt( "\tWhat is the username?" );
@@ -94,6 +98,7 @@
$pass = $build->prompt( "\tWhat is the password?" );
}
}
+ }
$build->notes( 'TEST_MYSQL_DSN' => $dsn );
$build->notes( 'TEST_MYSQL_USER' => $user );