[CDBI] Two MySQL tests failed during Class::DBI installation; how I fixed 'em
Dave Baker <davebaker-G6Ux/[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.class-dbi |
|---|---|
| Message-ID | <[email protected]> |
When I used the CPAN to install Class::DBI 3.0.16, several tests
involving MySQL failed. After some trial and error, I was able to get
the tests to work, so I'm posting this message to the newsgroup in
case somebody else runs into the same situation in the future (so
that a search of the archive might turn up this message).
When using my cpan executable to do the install, I got these
results:
t/10-mysql...............DBI connect('test','',...) failed: Access
denied for user 'root'@'localhost' (using password: NO) at
t/testlib/MyBase.pm line 10 skipped all skipped: Need MySQL for this
test
t/25-closures_in_meta....DBI connect('test','',...) failed: Access
denied for user 'root'@'localhost' (using password: NO) at
t/testlib/MyBase.pm line 10 skipped all skipped: Need MySQL for this
test
Because I want to use MySQL with Class::DBI, I wanted to be sure
those tests would succeed. I was able to get the tests to run by (1)
downloading Class::DBI from the CPAN, (2) editing a test module, (3)
running the test suite manually, and then (4) installing Class::DBI
manually. I already had MySQL up and running. Here are the details:
Typing cpan at the shell brings up the cpan> prompt on my machine.
Then:
cpan>get Class::DBI
On my machine, that put the files into
/root/.cpan/build/Class-DBI-v3.0.16
Then:
cpan>bye (to exit cpan)
And then these commands in the shell:
cd /root/.cpan/build/Class-DBI-v3.0.16
perl Makefile.PL
make
cd t/testlib/
Then, using a text editor, I changed this line in MyBase.pm:
my @connect = ("dbi:mysql:test", "", "");
to say this instead:
my @connect = ("dbi:mysql:test", "root", "yabbadabbado");
(where yabbadabbado is the MySQL password for the MySQL user named
"root")
After saving the changes to that file, I entered these commands in
the shell:
cd /root/.cpan/build/Class-DBI-v3.0.16
make test
Success! The MySQL tests -- t/10 and t/25 -- succeeded this time.
Then I entered:
make install
to complete the installation.
I suppose the line in MyBase.pm could be edited to refer to any MySQL
user who has sufficient privileges on the database named "test",
rather than using MySQL's "root" user. I think the "test" database is
created by MySQL when it's installed; I already had one on my
machine.
Dave Baker
(not a professional programmer, but a happy Perl user)