Subject: | Apache::DBI dumps unnecessary warnings to Apache log files |
When using Apache::DBI with some DBI->connect calls, unnecessary warnings about uninitialized variables get dumped on every call. These warnings are generated when not enough information is passed to the connect() method. This can happen when using DBI_DSN to make the connection to the web server. We are experiencing this when we are using mysql_read_defaults_file directive in the DBI_DSN. We don't pass in a password or username and these end up being uninitialized in the information that gets passed to the Apache::DBI::connect method. The attached patch disables warnings when making the unique connect string for the connection.
--- DBI.pm 2004-01-09 17:53:18.000000000 -0800
+++ /opt/lib/perl5/site_perl/5.8.3/Apache/DBI.pm 2004-01-22 10:40:28.000000000 -0800
@@ -72,6 +72,7 @@
# the hash-reference differs between calls even in the same
# process, so de-reference the hash-reference
if (3 == $#args and ref $args[3] eq "HASH") {
+ local $^W;
map { $Idx .= "$;$_=$args[3]->{$_}" } sort keys %{$args[3]};
} elsif (3 == $#args) {
pop @args;