tie *$handle, 'Object::Remote::GlobProxy', $glob_container;
return $handle;
}
+ )->filter_json_single_key_object(
+ __local_object__ => sub {
+ $self->local_objects_by_id->{$_[0]}
+ }
);
}
my ($class, $spec) = @_;
return $spec if blessed $spec;
foreach my $poss (do { our @Guess }) {
- if (my $obj = $poss->($spec)) { return $obj }
+ if (my $conn = $poss->($spec)) {
+ return $conn->maybe::start::connect;
+ }
}
die "Couldn't figure out what to do with ${spec}";
}
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 };