# is it in the LRU cache?
my $ref = $lru->get($call);
- return $ref if $ref && ref $ref eq 'DXUser';
+ return $ref if $ref && UNIVERSAL::isa($ref, 'DXUser');
# search for it
if ($v4) {
if ($data = _select($call)) {
$ref = bless decode_json($data), 'DXUser';
+ unless ($ref) {
+ dbg("DXUser::get: no reference returned from decode of $call $!");
+ return undef;
+ }
}
} else {
unless ($dbm->get($call, $data)) {
$ref = decode($data);
+ unless ($ref) {
+ dbg("DXUser::get: no reference returned from decode of $call $!");
+ return undef;
+ }
}
}
if ($ref) {
- if (UNIVERSAL::isa($ref, 'DXUser')) {
+ if (!UNIVERSAL::isa($ref, 'DXUser')) {
dbg("DXUser::get: got strange answer from decode of $call". ref $ref. " ignoring");
return undef;
}
+
# we have a reference and it *is* a DXUser
- } else {
- dbg("DXUser::get: no reference returned from decode of $call $!");
- return undef;
+ $lru->put($call, $ref);
+ return $ref;
}
- $lru->put($call, $ref);
return undef;
}