X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FObject%2FRemote%2FConnection.pm;h=3e35d53a605d3b1ab11d299d1646530b7551a7ce;hb=c6fe6fbd88a05e860ecdc8942cb86940915172ed;hp=291b5540820522822e2314c7f770f87f9f153148;hpb=a980b0b8d4033a154d0e76caa63dab7899515639;p=scpubgit%2FObject-Remote.git diff --git a/lib/Object/Remote/Connection.pm b/lib/Object/Remote/Connection.pm index 291b554..3e35d53 100644 --- a/lib/Object/Remote/Connection.pm +++ b/lib/Object/Remote/Connection.pm @@ -92,12 +92,26 @@ BEGIN { 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 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);