Subject: | When unknown driver is specified in ~/.test-database, use Test::Database fails |
If the file ~/.test-database contains single line
driver = Nonexistent
running
$ perl -MTest::Database -e 1
fails with
Can't locate Test/Database/Driver/Nonexistent.pm in @INC (@INC contains:
/usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0
/usr/lib/perl5/site_perl .) at (eval 13) line 3.
at /usr/local/lib/perl5/site_perl/5.10.0/Test/Database.pm line 117
Compilation failed in require.
BEGIN failed--compilation aborted.
I think that just doing use should not fail because of (old) content of
~/.test-database. The module should parse the file (if it insists on
parsing it upon use), try to load the drivers/DBD's, but if any of that
fails, the information about failed attempts could be available
somewhere but the use should succeed.
Similar problem happens if you have
driver = Pg
specified there but you do not have DBD::Pg installed:
install_driver(Pg) failed: Can't locate DBD/Pg.pm in @INC (@INC
contains: /usr/local/lib/perl5/site_perl/5.10.0/i386-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.10.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0 /usr/lib/perl5/vendor_perl
/usr/lib/perl5/5.10.0/i386-linux-thread-multi /usr/lib/perl5/5.10.0
/usr/lib/perl5/site_perl .) at (eval 14) line 3.
Perhaps the DBD::Pg perl module hasn't been fully installed,
or perhaps the capitalisation of 'Pg' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, Sponge.
at /usr/local/lib/perl5/site_perl/5.10.0/Test/Database/Driver.pm line 39
Compilation failed in require.
BEGIN failed--compilation aborted.