1 package Object::Remote::Role::Connector;
3 use Module::Runtime qw(use_module);
4 use Object::Remote::Future;
9 has timeout => (is => 'ro', default => sub { { after => 10 } });
13 my ($send_to_fh, $receive_from_fh, $child_pid) = $self->_open2_for(@_);
14 my $channel = use_module('Object::Remote::ReadChannel')->new(
15 fh => $receive_from_fh
19 $channel->on_line_call(sub {
20 if ($_[0] eq "Shere") {
22 use_module('Object::Remote::Connection')->new(
23 send_to_fh => $send_to_fh,
24 read_channel => $channel,
25 child_pid => $child_pid,
29 $f->fail("Expected Shere from remote but received: $_[0]");
33 $channel->on_close_call(sub {
34 $f->fail("Channel closed without seeing Shere: $_[0]");
37 Object::Remote->current_loop
41 $f->fail("Connection timed out") unless $f->is_ready;