Do the correct thing with type contraints etc to be able to serialize things
[catagits/Gitalist.git] / lib / Gitalist / Git / HasUtils.pm
CommitLineData
76fa4452 1use MooseX::Declare;
2
3role Gitalist::Git::HasUtils {
4 use Gitalist::Git::Util;
e6e5020e 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 /],
e6e5020e 25 traits => [qw/ DoNotSerialize /],
76fa4452 26 );
27 method _build_util { confess(shift() . " cannot build _util") }
28}
38b9e5c8 29
301;
775e96e0 31
32__END__
33
271f6b46 34=head1 NAME
35
36Gitalist::Git::HasUtils - Role for classes with an instance of Gitalist::Git::Util
37
775e96e0 38=head1 AUTHORS
39
40See L<Gitalist> for authors.
41
42=head1 LICENSE
43
44See L<Gitalist> for the license.
45
46=cut