Commit | Line | Data |
76fa4452 |
1 | use MooseX::Declare; |
2 | |
3 | role Gitalist::Git::HasUtils { |
4 | use Gitalist::Git::Util; |
2c130350 |
5 | use MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize; |
76fa4452 |
6 | |
7 | method BUILD {} |
8 | after BUILD { |
9 | # Force value build |
10 | $self->meta->get_attribute('_util')->get_read_method_ref->($self); |
11 | } |
12 | |
13 | has _util => ( |
14 | isa => 'Gitalist::Git::Util', |
15 | lazy => 1, |
16 | is => 'bare', |
17 | builder => '_build_util', |
18 | handles => [qw/ |
19 | run_cmd |
20 | run_cmd_fh |
21 | run_cmd_list |
22 | get_gpp_object |
23 | gpp |
24 | /], |
2c130350 |
25 | traits => [qw/ DoNotSerialize /], |
76fa4452 |
26 | ); |
27 | method _build_util { confess(shift() . " cannot build _util") } |
28 | } |
38b9e5c8 |
29 | |
30 | 1; |
775e96e0 |
31 | |
32 | __END__ |
33 | |
271f6b46 |
34 | =head1 NAME |
35 | |
36 | Gitalist::Git::HasUtils - Role for classes with an instance of Gitalist::Git::Util |
37 | |
775e96e0 |
38 | =head1 AUTHORS |
39 | |
40 | See L<Gitalist> for authors. |
41 | |
42 | =head1 LICENSE |
43 | |
44 | See L<Gitalist> for the license. |
45 | |
46 | =cut |