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   16 use Moose;
  4         5  
  4         22  
3 4     4   16443 use MooseX::StrictConstructor;
  4         8  
  4         26  
4 4     4   7537 use Moose::Util::TypeConstraints;
  4         6  
  4         30  
5 4     4   6850 use IPC::Open2;
  4         10504  
  4         204  
6 4     4   22 use namespace::autoclean;
  4         6  
  4         33  
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;