add ability to do discard sends and make things basically work
[scpubgit/Object-Remote.git] / lib / Object / Remote.pm
index 35f5c03..cd3a364 100644 (file)
@@ -9,10 +9,8 @@ has connection => (is => 'ro', required => 1);
 
 has id => (is => 'rwp');
 
-has proxy => (is => 'lazy', weak_ref => 1);
-
-sub _build_proxy {
-  bless({ remote => $_[0] }, 'Object::Remote::Proxy');
+sub proxy {
+  bless({ remote => $_[0], method => 'call' }, 'Object::Remote::Proxy');
 }
 
 sub BUILD {
@@ -40,6 +38,11 @@ sub call {
   $self->_await($self->connection->send(call => $self->id, $method, @args));
 }
 
+sub call_discard {
+  my ($self, $method, @args) = @_;
+  $self->connection->send_discard(call => $self->id, $method, @args);
+}
+
 sub _await {
   my ($self, $future) = @_;
   my $loop = $self->current_loop;