File Coverage

blib/lib/Git/PurePerl/Protocol/SSH.pm
Criterion Covered Total %
statement 15 24 62.5
branch n/a
condition n/a
subroutine 5 6 83.3
pod 0 1 0.0
total 20 31 64.5


line stmt bran cond sub pod time code
1             package Git::PurePerl::Protocol::SSH;
2 4     4   25 use Moose;
  4         6  
  4         27  
3 4     4   23139 use MooseX::StrictConstructor;
  4         27  
  4         36  
4 4     4   10610 use Moose::Util::TypeConstraints;
  4         9  
  4         40  
5 4     4   9429 use IPC::Open2;
  4         13149  
  4         260  
6 4     4   27 use namespace::autoclean;
  4         9  
  4         36  
7              
8             extends 'Git::PurePerl::Protocol';
9              
10             has 'hostname' => ( is => 'ro', isa => 'Str', required => 1 );
11             has 'username' => ( is => 'ro', isa => 'Str', required => 0 );
12             has 'path' => ( is => 'ro', isa => 'Str', required => 1 );
13              
14             sub connect_socket {
15 0     0 0   my $self = shift;
16              
17 0           my ($read, $write);
18 0           my $connect = join('@', grep {defined} $self->username, $self->hostname);
  0            
19 0           my $pid = open2(
20             $read, $write,
21             "ssh", $connect,
22             "-o", "BatchMode yes",
23             "git-upload-pack", $self->path,
24             );
25              
26 0           $read->autoflush(1);
27 0           $write->autoflush(1);
28 0           $self->read_socket($read);
29 0           $self->write_socket($write);
30             }
31              
32             1;