3 class Gitalist::Git::Object {
4 use MooseX::Types::Moose qw/Str Int/;
5 use File::Stat::ModeString qw/mode_to_string/;
6 has project => ( isa => 'Gitalist::Git::Project',
9 handles => [ 'run_cmd' ],
11 has $_ => ( isa => Str,
15 has $_ => ( isa => Str,
19 for qw/type modestr size/;
20 has $_ => ( isa => Int,
26 my $output = $self->run_cmd(qw/cat-file -t/, $self->{sha1});
31 method _build_modestr {
32 my $modestr = mode_to_string($self->{mode});
37 my $output = $self->run_cmd(qw/cat-file -s/, $self->{sha1});
44 Return the contents of a given file.
49 if ( $self->type ne 'blob' ) {
50 die "object $self->sha1 is not a file\n"
53 my $output = $self->run_cmd(qw/cat-file -p/, $self->sha1);
54 return unless $output;