sketch out some service code
[scpubgit/Clifton.git] / lib / App / Clifton / ServiceContainer.pm
CommitLineData
20038dd8 1package App::Clifton::ServiceContainer;
2
3use aliased 'App::Clifton::JabberService';
4use aliased 'App::Clifton::IRCService';
5use aliased 'App::Clifton::ConsoleService';
6use Log::Contextual qw(:log);
7use Moo;
8
9extends 'App::Clifton::Component';
10
11has jabber => (is => 'lazy');
12has irc => (is => 'lazy');
13has console => (is => 'lazy');
14
15sub BUILD {
16 my ($self) = @_;
17 $self->$_ for qw(console irc jabber);
18}
19
20sub _build_jabber {
21 my ($self) = @_;
22 log_debug { "Spawning jabber service" };
23 $self->_new_child(JabberService, { irc_service => $self->irc });
24}
25
26sub _build_irc {
27 my ($self) = @_;
28 log_debug { "Spawning IRC service" };
29 $self->_new_child(IRCService, {});
30}
31
32sub _build_console {
33 my ($self) = @_;
34 log_debug { "Spawning console service" };
35 $self->_new_child(ConsoleService, {});
36}
37
381;