remoting works
[scpubgit/Object-Remote.git] / lib / Object / Remote / Role / Connector.pm
CommitLineData
47c83a13 1package Object::Remote::Role::Connector;
2
84b04178 3use Module::Runtime qw(use_module);
47c83a13 4use Moo::Role;
5
6requires '_open2_for';
7
8sub connect {
9 my $self = shift;
10 my %args;
11 @args{qw(send_to_fh receive_from_fh child_pid)} = $self->_open2_for(@_);
12 my $line = readline($args{receive_from_fh});
13 unless ($line eq "Shere\n") {
14 die "New remote container did not send Shere - got ${line}";
15 }
84b04178 16 return use_module('Object::Remote::Connection')->new(\%args);
47c83a13 17}
18
191;