1 package Object::Remote::Role::Connector;
3 use Module::Runtime qw(use_module);
4 use Object::Remote::Future;
11 my ($send_to_fh, $receive_from_fh, $child_pid) = $self->_open2_for(@_);
12 my $channel = use_module('Object::Remote::ReadChannel')->new(
13 fh => $receive_from_fh
17 $channel->on_line_call(sub {
18 if ($_[0] eq "Shere") {
20 use_module('Object::Remote::Connection')->new(
21 send_to_fh => $send_to_fh,
22 read_channel => $channel,
23 child_pid => $child_pid,
27 $f->fail("Expected Shere from remote but received: $_[0]");
31 $channel->on_close_call(sub {
32 $f->fail("Channel closed without seeing Shere: $_[0]");
35 Object::Remote->current_loop
39 $f->fail("Connection timed out") unless $f->is_ready;