X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FConnection.pm;h=da80bac8ae2f4b8e559cb512edb86a7c2d0b70c7;hp=ed78e0e09854c66b656050cff711f5bb0159581a;hb=6163a5aa713c3e27a6c6cd4060e20b556dbef269;hpb=6b353e966ee45889021503f14e4b8814c7a8be58 diff --git a/lib/Object/Remote/Connection.pm b/lib/Object/Remote/Connection.pm index ed78e0e..da80bac 100644 --- a/lib/Object/Remote/Connection.pm +++ b/lib/Object/Remote/Connection.pm @@ -104,6 +104,10 @@ sub _build__json { tie *$handle, 'Object::Remote::GlobProxy', $glob_container; return $handle; } + )->filter_json_single_key_object( + __local_object__ => sub { + $self->local_objects_by_id->{$_[0]} + } ); } @@ -243,7 +247,14 @@ sub _local_object_to_id { sub _deobjectify { my ($self, $data) = @_; if (blessed($data)) { - return +{ __remote_object__ => $self->_local_object_to_id($data) }; + if ( + $data->isa('Object::Remote::Proxy') + and $data->{remote}->connection == $self + ) { + return +{ __local_object__ => $data->{remote}->id }; + } else { + return +{ __remote_object__ => $self->_local_object_to_id($data) }; + } } elsif (my $ref = ref($data)) { if ($ref eq 'HASH') { return +{ map +($_ => $self->_deobjectify($data->{$_})), keys %$data };