PurePerl/Object/Tree.pm

filter: Statementstmt 100% 31 / 31 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.1% 39 / 41 CC 3 SCAR 6.2
CC
3
Cov
97%
BUILD
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.9
« PurePerl/NewObject/Commit.pm ↑ Summary PurePerl/Loose.pm »
1 package Git::PurePerl::Object::Tree;
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 extends 'Git::PurePerl::Object';
8  
9 4 has 'kind' =>
10 ( is => 'ro', isa => 'ObjectKind', required => 1, default => 'tree' );
11 4 has 'directory_entries' => (
12 is => 'rw',
13 isa => 'ArrayRef[Git::PurePerl::DirectoryEntry]',
14 required => 0,
15 auto_deref => 1,
16 );
17  
18 30 ▶sub BUILD {
Subroutine BUILD: called CC=3 SCAR=11.0
Pod undocumented
19 30 my $self = shift;
20 30 my $content = $self->content;
21 30 ▶ return unless $content;
Branch: 1 branch
BranchTrueFalseTotal
unless $content 0 30 30
22 30 my @directory_entries;
23 30 ▶ while ($content) {
Branch: 1 branch
BranchTrueFalseTotal
if ($content) 39 30 69
24 39 my $space_index = index( $content, ' ' );
25 39 my $mode = substr( $content, 0, $space_index );
26 39 $content = substr( $content, $space_index + 1 );
27 39 my $null_index = index( $content, "\0" );
28 39 my $filename = substr( $content, 0, $null_index );
29 39 $content = substr( $content, $null_index + 1 );
30 39 my $sha1 = unpack( 'H*', substr( $content, 0, 20 ) );
31 39 $content = substr( $content, 20 );
32 39 push @directory_entries,
33 Git::PurePerl::DirectoryEntry->new(
34 mode => $mode,
35 filename => $filename,
36 sha1 => $sha1,
37 git => $self->git,
38 );
39 }
40 30 $self->directory_entries( \@directory_entries );
41 }
42  
43 4 __PACKAGE__->meta->make_immutable;
44  
« PurePerl/NewObject/Commit.pm ↑ Summary PurePerl/Loose.pm »