Remote/Connector/STDIO.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran n/a Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 48 CC 1 SCAR 6.9
CC
1
Cov
0%
connect
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Object::Remote::Connector::STDIO;
2  
3 use File::Spec;
4 use IO::Handle;
5 use Object::Remote::Connection;
6 use Object::Remote::ReadChannel;
7 use Moo;
8  
9 sub connect {
10 open my $stdin, '<&', \*STDIN or die "Duping stdin: $!";
11 open my $stdout, '>&', \*STDOUT or die "Duping stdout: $!";
12 $stdout->autoflush(1);
13 # if we don't re-open them then 0 and 1 get re-used - which is not
14 # only potentially bloody confusing but results in warnings like:
15 # "Filehandle STDOUT reopened as STDIN only for input"
16 close STDIN or die "Closing stdin: $!";
17 open STDIN, '<', File::Spec->devnull or die "Re-opening stdin: $!";
18 close STDOUT or die "Closing stdout: $!";
19 open STDOUT, '>', File::Spec->devnull or die "Re-opening stdout: $!";
20 return Object::Remote::Connection->new(
21 send_to_fh => $stdout,
22 read_channel => Object::Remote::ReadChannel->new(fh => $stdin)
23 );
24 }
25  
26 1;