X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=scpubgit%2FObject-Remote.git;a=blobdiff_plain;f=lib%2FObject%2FRemote%2FHandle.pm;h=7e9c21870d976037e7fbe02799ea344dc1851d9c;hp=8b1bd3199ac076e5e47aa02b8487be4297bf95fe;hb=5add5e29851e82862e4d8f6d67dfce559f6685ce;hpb=d2eadebbdb4416f421ffd5298c782fdc32f388e7 diff --git a/lib/Object/Remote/Handle.pm b/lib/Object/Remote/Handle.pm index 8b1bd31..7e9c218 100644 --- a/lib/Object/Remote/Handle.pm +++ b/lib/Object/Remote/Handle.pm @@ -14,7 +14,7 @@ use Moo; BEGIN { router()->exclude_forwarding } has connection => ( - is => 'ro', required => 1, + is => 'ro', required => 1, handles => ['is_valid'], coerce => sub { blessed($_[0]) ? $_[0] @@ -58,11 +58,14 @@ sub BUILD { sub call { my ($self, $method, @args) = @_; my $w = wantarray; - log_trace { my $def = defined $w ? 1 : 0; "call() has been invoked on a remote handle; wantarray: '$def'" }; + my $id = $self->id; $method = "start::${method}" if (caller(0)||'') eq 'start'; + log_trace { "call('$method') has been invoked on remote handle '$id'; creating future" }; + future { - $self->connection->send(call => $self->id, $w, $method, @args) + log_debug { "Invoking send on connection for handle '$id' method $method" }; + $self->connection->send(call => $id, $w, $method, @args) }; }