Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Problem with Perl DBD::Mysql module tests

From: Paul Wayper <paul.wayper(at)anu.edu.au>
Date: Sun Jul 22 2007 - 21:09:48 EDT


Hi there!

I recently had to install the Perl DBD::Mysql module from CPAN (using perl -MCPAN -e shell). As a good administrator I have changed the root MySQL password, and this causes the make tests to fail. With a little digging around in t/lib.pm I found that if I set the environment variable DBI_PASS and run the tests it would import it. However, this did not work and the $::test_password variable remained blank. Further digging around found that, in the import of t/mysql.mtest it overwrites all the variables that have been previously set. I made a couple of changes to the mtest file to preserve any previously set variables and include the diff here:

  • ../DBD-mysql-4.005-MXzdoi/t/mysql.mtest 2007-07-20 17:31:37.000000000 +1000 +++ t/mysql.mtest 2007-07-23 10:53:54.000000000 +1000 @@ -12,13 +12,13 @@ 'testpassword' => '', 'testsocket' => '' };
    -$::test_host = $opt->{'testhost'};
    -$::test_port = $opt->{'testport'};
    -$::test_user = $opt->{'testuser'};
    -$::test_socket = $opt->{'testsocket'};
    -$::test_password = $opt->{'testpassword'};
    -$::test_db = $opt->{'testdb'};
    -$::test_dsn = "DBI:mysql:$::test_db";
    +$::test_host = $::test_host || $opt->{'testhost'}; +$::test_port = $::test_port || $opt->{'testport'}; +$::test_user = $::test_user || $opt->{'testuser'}; +$::test_socket = $::test_socket || $opt->{'testsocket'}; +$::test_password = $::test_password || $opt->{'testpassword'}; +$::test_db = $::test_db || $opt->{'testdb'}; +$::test_dsn = $::test_dsn || "DBI:mysql:$::test_db"; $::test_dsn .= ";mysql_socket=$::test_socket" if $::test_socket; $::test_dsn .= ":$::test_host" if $::test_host; $::test_dsn .= ":$::test_port" if $::test_port;

While it may make sense for standalone builds with non-default security to pass the required environment by altering the mysql.mtest file, for CPAN builds it makes more sense to allow the user to set the DBI_xxxx environment variables.

Please let me know if there is a more appropriate place to submit this patch, or any feedback on it.

Hope this helps,

Paul

-- 
MySQL Perl Mailing List
For list archives: 
http://lists.mysql.com/perl
To unsubscribe:    
http://lists.mysql.com/perl?unsub=lists@pantek.com
Received on Thu Jul 26 20:11:57 2007

This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:30:42 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library