sub new_from_spec {
my ($class, $spec) = @_;
+ return $spec if blessed $spec;
foreach my $poss (do { our @Guess }) {
if (my $obj = $poss->($spec)) { return $obj }
}
die "Couldn't figure out what to do with ${spec}";
}
+sub new_remote {
+ my ($self, @args) = @_;
+ Object::Remote::Handle->new(
+ connection => $self, @args
+ )->proxy;
+}
+
+sub connect {
+ my ($self, $to) = @_;
+ return await_future($self->send(
+ class_call => 'Object::Remote', 0, connect => $to
+ ));
+}
+
+sub get_remote_sub {
+ my ($self, $sub) = @_;
+ my ($pkg, $name) = $sub =~ m/^(.*)::([^:]+)$/;
+ return await_future($self->send(class_call => $pkg, 0, can => $name));
+}
+
sub register_remote {
my ($self, $remote) = @_;
weaken($self->remote_objects_by_id->{$remote->id} = $remote);