fixing inline pod documentation for the debian package. (missing whatis entry)
[catagits/Gitalist.git] / lib / Gitalist / Git / Object / HasTree.pm
1 package Gitalist::Git::Object::HasTree;
2 use MooseX::Declare;
3
4 role Gitalist::Git::Object::HasTree {
5     has tree => ( isa => 'ArrayRef[Gitalist::Git::Object]',
6                   required => 0,
7                   is => 'ro',
8                   lazy_build => 1 );
9
10
11 ## Builders
12     method _build_tree {
13         my $output = $self->_run_cmd(qw/ls-tree -z/, $self->sha1);
14         return unless defined $output;
15
16         my @ret;
17         for my $line (split /\0/, $output) {
18             my ($mode, $type, $object, $file) = split /\s+/, $line, 4;
19             my $class = 'Gitalist::Git::Object::' . ucfirst($type);
20             push @ret, $class->new( mode => oct $mode,
21                                     type => $type,
22                                     sha1 => $object,
23                                     file => $file,
24                                     repository => $self->repository,
25                                   );
26         }
27         return \@ret;
28     }
29
30 }
31
32 1;
33
34
35 1;
36
37 __END__
38
39 =head1 NAME
40
41 Gitalist::Git::Object::HasTree - Git::Object::HasTree module for Gitalist
42
43 =head1 SYNOPSIS
44
45     my $tree = Repository->get_object($tree_sha1);
46
47 =head1 DESCRIPTION
48
49 Role for objects which have a tree - C<Commit> and C<Tree> objects.
50
51
52 =head1 ATTRIBUTES
53
54 =head2 tree
55
56
57 =head1 METHODS
58
59
60 =head1 AUTHORS
61
62 See L<Gitalist> for authors.
63
64 =head1 LICENSE
65
66 See L<Gitalist> for the license.
67
68 =cut