[Bast-commits] r9824 - DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor

arcanez at dev.catalyst.perl.org arcanez at dev.catalyst.perl.org
Tue Jan 25 12:32:19 GMT 2011


Author: arcanez
Date: 2011-01-25 12:32:18 +0000 (Tue, 25 Jan 2011)
New Revision: 9824

Modified:
   DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor/Cached.pm
Log:
streamlined db connection disambiguation, per Tim Bunce

Modified: DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor/Cached.pm
===================================================================
--- DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor/Cached.pm	2011-01-23 14:28:06 UTC (rev 9823)
+++ DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor/Cached.pm	2011-01-25 12:32:18 UTC (rev 9824)
@@ -54,23 +54,19 @@
   # and not any other cruft in $attrs
   my $ref = $storage->_select_args_to_query(@{$args}[0..2], $attrs);
 
-  my ($connect_info, $dbname, $username);
-  $connect_info = $storage->_dbi_connect_info;
-  if (my $dbh = $storage->_dbh) {
-    $dbname = $dbh->{Name};
-    $username = $dbh->{Username} || '';
-  } elsif (! ref($connect_info->[0]) ) {
-    $dbname = $connect_info->[0];
-    $username = $connect_info->[1] || '';
-  } else {
-    carp "Invoking connector coderef $connect_info->[0] in order to obtain cache-lookup information";
-    my $dbh = $connect_info->[0]->();
-    $dbname = $dbh->{Name};
-    $username = $dbh->{Username} || '';
+  my $conn;
+  if (! ($conn = $storage->_dbh) ) {
+    my $connect_info = $storage->_dbi_connect_info;
+    if (! ref($connect_info->[0]) ) {
+      $conn = { Name => $connect_info->[0], Username => $connect_info->[1] };
+    } else {
+      carp "Invoking connector coderef $connect_info->[0] in order to obtain cache-lookup information";
+      $conn = $connect_info->[0]->();
+    }
   }
   
   local $Storable::canonical = 1;
-  return Digest::SHA1::sha1_hex(Storable::nfreeze( [ $ref, $dbname, $username ] ));
+  return Digest::SHA1::sha1_hex(Storable::nfreeze( [ $ref, $conn->{Name}, $conn->{Username} || '' ] ));
 
 }
 




More information about the Bast-commits mailing list