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