notes, for the record
[scpubgit/Clifton.git] / lib / App / Clifton / Service.pm
CommitLineData
20038dd8 1package App::Clifton::Service;
2
3use aliased 'App::Clifton::Task';
4use Moo;
5
6extends 'App::Clifton::Component';
7
8sub _do {
9 my ($self, $do, @args) = @_;
10 my $body = do {
11 my $body_call = $self->_capture_weakself("_body_for_${do}");
12 sub { $body_call->(@args, @_) }
13 };
14 my $deps = {};
15 if (my $dep_call = $self->can("_dependencies_for_${do}")) {
16 $deps = $self->$dep_call(@args);
17 }
18 $self->_new_child(Task, {
19 name => $do, body => $body, dependencies => $deps
20 });
21}
22
231;