line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Git::PurePerl::NewObject; |
2
|
4
|
|
|
4
|
|
19
|
use Moose; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
24
|
|
3
|
4
|
|
|
4
|
|
19716
|
use MooseX::StrictConstructor; |
|
4
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
32
|
|
4
|
4
|
|
|
4
|
|
8989
|
use Moose::Util::TypeConstraints; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
39
|
|
5
|
4
|
|
|
4
|
|
6162
|
use namespace::autoclean; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
33
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
enum 'ObjectKind' => [qw(commit tree blob tag)]; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'kind' => ( is => 'ro', isa => 'ObjectKind', required => 1 ); |
10
|
|
|
|
|
|
|
has 'size' => ( is => 'ro', isa => 'Int', required => 0, lazy_build => 1 ); |
11
|
|
|
|
|
|
|
has 'content' => ( is => 'rw', isa => 'Str', required => 0, lazy_build => 1 ); |
12
|
|
|
|
|
|
|
has 'sha1' => ( is => 'ro', isa => 'Str', required => 0, lazy_build => 1 ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub _build_sha1 { |
15
|
14
|
|
|
14
|
|
18
|
my $self = shift; |
16
|
14
|
|
|
|
|
125
|
my $sha1 = Digest::SHA->new; |
17
|
14
|
|
|
|
|
269
|
$sha1->add( $self->raw ); |
18
|
14
|
|
|
|
|
94
|
my $sha1_hex = $sha1->hexdigest; |
19
|
14
|
|
|
|
|
57
|
return $sha1_hex; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _build_size { |
23
|
14
|
|
|
14
|
|
19
|
my $self = shift; |
24
|
14
|
|
|
|
|
459
|
return length $self->content; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub raw { |
28
|
28
|
|
|
28
|
0
|
42
|
my $self = shift; |
29
|
28
|
|
|
|
|
1093
|
return $self->kind . ' ' . $self->size . "\0" . $self->content; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
33
|
|
|
|
|
|
|
|