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   15 use Moose;
  4         5  
  4         23  
3 4     4   16569 use MooseX::StrictConstructor;
  4         7  
  4         22  
4 4     4   6991 use Moose::Util::TypeConstraints;
  4         6  
  4         24  
5 4     4   4822 use namespace::autoclean;
  4         6  
  4         22  
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 2 my $self = shift;
15              
16 1   50     50 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       86504 $socket->autoflush(1) || die $!;
22 1         222 $self->read_socket($socket);
23 1         51 $self->write_socket($socket);
24              
25 1         45 $self->send_line( "git-upload-pack "
26             . $self->project
27             . "\0host="
28             . $self->hostname
29             . "\0" );
30             }
31              
32             1;