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   15 use Moose;
  4         6  
  4         20  
3 4     4   15746 use MooseX::StrictConstructor;
  4         5  
  4         26  
4 4     4   7496 use Moose::Util::TypeConstraints;
  4         8  
  4         28  
5 4     4   7016 use IPC::Open2;
  4         10323  
  4         191  
6 4     4   21 use namespace::autoclean;
  4         6  
  4         30  
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;