[Bast-commits] r9822 -
DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor
arcanez at dev.catalyst.perl.org
arcanez at dev.catalyst.perl.org
Sun Jan 23 14:27:45 GMT 2011
Author: arcanez
Date: 2011-01-23 14:27:45 +0000 (Sun, 23 Jan 2011)
New Revision: 9822
Modified:
DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor/Cached.pm
Log:
clean up the logic a little bit
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-21 01:52:50 UTC (rev 9821)
+++ DBIx-Class-Cursor-Cached/1.000/trunk/lib/DBIx/Class/Cursor/Cached.pm 2011-01-23 14:27:45 UTC (rev 9822)
@@ -5,6 +5,7 @@
use 5.6.1;
use Storable ();
use Digest::SHA1 ();
+use Carp::Clan qw/^DBIx::Class/;
use vars qw($VERSION);
@@ -52,15 +53,20 @@
# so the cache key is only affected by what the database sees
# and not any other cruft in $attrs
my $ref = $storage->_select_args_to_query(@{$args}[0..2], $attrs);
- my $connect_info = $storage->_dbi_connect_info;
- my ($dbname, $username);
- if (ref($connect_info->[0]) eq 'CODE') {
- my $dbh = $connect_info->[0]->();
+
+ my ($connect_info, $dbname, $username);
+ $connect_info = $storage->_dbi_connect_info;
+ if (my $dbh = $storage->_dbh) {
$dbname = $dbh->{Name};
$username = $dbh->{Username} || '';
- } else {
+ } 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} || '';
}
local $Storable::canonical = 1;
More information about the Bast-commits
mailing list