search sensibly for the object-remote-node script
[scpubgit/Object-Remote.git] / lib / Object / Remote / Connector / Local.pm
1 package Object::Remote::Connector::Local;
2
3 use IPC::Open2;
4 use Moo;
5
6 with 'Object::Remote::Role::Connector';
7
8 sub _open2_for {
9   my $open_this = (
10     -d 't' && -e 'bin/object-remote-node'
11       ? 'bin/object-remote-node'
12       : 'object-remote-node'
13   );
14   my $pid = open2(my $its_stdout, my $its_stdin, 'bin/object-remote-node')
15     or die "Couldn't start local node: $!";
16   return ($its_stdin, $its_stdout, $pid);
17 }
18
19 push @Object::Remote::Connection::Guess, sub {
20   if (($_[0]||'') eq '-') { __PACKAGE__->new->connect }
21 };
22
23 1;