Subject: | connect_cached throws warning after a clone |
I noticed that under some circumstances (after a clone, for example) the $attr hashref had keys with undef values in it. In connect_cached, this would cause join to throw a warning. The attached patch kills this warning.
diff -Naur DBI-1.46.orig/DBI.pm DBI-1.46/DBI.pm
--- DBI-1.46.orig/DBI.pm 2004-11-16 12:23:38.000000000 +0000
+++ DBI-1.46/DBI.pm 2005-01-27 16:32:56.000000000 +0000
@@ -1400,8 +1400,11 @@
$drh->STORE('CachedKids', $cache = {}) unless $cache;
my @attr_keys = $attr ? sort keys %$attr : ();
- my $key = join "~~", $dsn, $user||'', $auth||'',
- $attr ? (@attr_keys,@{$attr}{@attr_keys}) : ();
+ my $key = do {
+ local $^W = 0; # don't warn about keys with undef values in $attr
+ join "~~", $dsn, $user||'', $auth||'',
+ $attr ? (@attr_keys,@{$attr}{@attr_keys}) : ();
+ };
my $dbh = $cache->{$key};
if ($dbh && $dbh->FETCH('Active') && eval { $dbh->ping }) {
# XXX warn if BegunWork?