return $ref if $ref && ref $ref eq 'DXUser';
# search for it
- unless ($dbm->get($call, $data)) {
- $ref = decode($data);
- if ($ref) {
- 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 $!");
+ if ($v4) {
+ if ($data = _select($call)) {
- $ref = bless decode_json($data), __PACKAGE__;
- $lru->put($call, $ref);
- return $ref;
++ $ref = bless decode_json($data), 'DXUser';
+ }
+ } else {
+ unless ($dbm->get($call, $data)) {
+ $ref = decode($data);
- if ($ref) {
- if (ref $ref ne 'DXUser') {
- dbg("DXUser::get: got strange answer from decode ". ref $ref. " ignoring");
- return undef;
- }
- } else {
- dbg("DXUser::get: no reference returned from decode $!");
- return undef;
- }
- $lru->put($call, $ref);
- return $ref;
+ }
+ }
+
++ if ($ref) {
++ if (UNIVERSAL::isa($ref, 'DXUser')) {
++ dbg("DXUser::get: got strange answer from decode of $call". ref $ref. " ignoring");
+ return undef;
+ }
- $lru->put($call, $ref);
- return $ref;
++ # 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 undef;
}