PurePerl/NewObject.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 97.1% 34 / 35 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« PurePerl/DirectoryEntry.pm ↑ Summary PurePerl/Actor.pm »
1 package Git::PurePerl::NewObject;
2 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 enum 'ObjectKind' => [qw(commit tree blob tag)];
8  
9 4 has 'kind' => ( is => 'ro', isa => 'ObjectKind', required => 1 );
10 4 has 'size' => ( is => 'ro', isa => 'Int', required => 0, lazy_build => 1 );
11 4 has 'content' => ( is => 'rw', isa => 'Str', required => 0, lazy_build => 1 );
12 4 has 'sha1' => ( is => 'ro', isa => 'Str', required => 0, lazy_build => 1 );
13  
14 14 ▶sub _build_sha1 {
Subroutine _build_sha1: called CC=1 SCAR=0.0
15 14 my $self = shift;
16 14 my $sha1 = Digest::SHA->new;
17 14 $sha1->add( $self->raw );
18 14 my $sha1_hex = $sha1->hexdigest;
19 14 return $sha1_hex;
20 }
21  
22 14 ▶sub _build_size {
Subroutine _build_size: called CC=1 SCAR=0.0
23 14 my $self = shift;
24 14 return length $self->content;
25 }
26  
27 28 ▶sub raw {
Subroutine raw: called CC=1 SCAR=0.0
Pod undocumented
28 28 my $self = shift;
29 28 return $self->kind . ' ' . $self->size . "\0" . $self->content;
30 }
31  
32 4 __PACKAGE__->meta->make_immutable;
33  
« PurePerl/DirectoryEntry.pm ↑ Summary PurePerl/Actor.pm »