package Object::Remote::Connection;
-use CPS::Future;
+use Object::Remote::Future;
use Object::Remote::Null;
use Object::Remote;
use IO::Handle;
$self->_receive($1);
}
} else {
- $self->on_close->();
+ $self->on_close->done();
}
}
sub _invoke {
my ($self, $future, $local, $ctx, $method, @args) = @_;
+ if ($method =~ /^start::/) {
+ my $f = $local->$method(@args);
+ $f->on_done(sub { undef($f); $future->done(@_) });
+ return unless $f;
+ $f->on_fail(sub { undef($f); $future->fail(@_) });
+ return;
+ }
my $do = sub { $local->$method(@args) };
eval {
$future->done(