File Coverage

blib/lib/Git/PurePerl/Protocol/Git.pm
Criterion Covered Total %
statement 18 18 100.0
branch 1 2 50.0
condition 1 2 50.0
subroutine 5 5 100.0
pod 0 1 0.0
total 25 28 89.2


line stmt bran cond sub pod time code
1             package Git::PurePerl::Protocol::Git;
2 4     4   23 use Moose;
  4         7  
  4         39  
3 4     4   22082 use MooseX::StrictConstructor;
  4         8  
  4         31  
4 4     4   10313 use Moose::Util::TypeConstraints;
  4         9  
  4         33  
5 4     4   6607 use namespace::autoclean;
  4         6  
  4         74  
6              
7             extends 'Git::PurePerl::Protocol';
8              
9             has 'hostname' => ( is => 'ro', isa => 'Str', required => 1 );
10             has 'port' => ( is => 'ro', isa => 'Int', required => 0, default => 9418 );
11             has 'project' => ( is => 'rw', isa => 'Str', required => 1 );
12              
13             sub connect_socket {
14 1     1 0 3 my $self = shift;
15              
16 1   50     29 my $socket = IO::Socket::INET->new(
17             PeerAddr => $self->hostname,
18             PeerPort => $self->port,
19             Proto => 'tcp'
20             ) || die $! . ' ' . $self->hostname . ':' . $self->port;
21 1 50       83315 $socket->autoflush(1) || die $!;
22 1         215 $self->read_socket($socket);
23 1         32 $self->write_socket($socket);
24              
25 1         30 $self->send_line( "git-upload-pack "
26             . $self->project
27             . "\0host="
28             . $self->hostname
29             . "\0" );
30             }
31              
32             1;