]>
Commit | Line | Data |
---|---|---|
8dc70d07 MG |
1 | package App::FonBot::Daemon; |
2 | ||
4e1612f3 | 3 | our $VERSION = '0.000_5'; |
8dc70d07 MG |
4 | |
5 | use 5.014000; | |
6 | use strict; | |
7 | use warnings; | |
8 | ||
9 | use Log::Log4perl qw//; | |
10 | use POE; | |
11 | ||
12 | use App::FonBot::Plugin::Config; | |
13 | use App::FonBot::Plugin::Common; | |
14 | use App::FonBot::Plugin::OFTC; | |
15 | use App::FonBot::Plugin::BitlBee; | |
16 | use App::FonBot::Plugin::HTTPD; | |
17 | ||
18 | use sigtrap qw/die normal-signals/; | |
19 | ||
20 | use constant PLUGINS => map { "App::FonBot::Plugin::$_" } qw/Config Common OFTC BitlBee HTTPD/; | |
21 | ||
22 | ################################################## | |
23 | ||
24 | sub run{ | |
962dff7b MG |
25 | Log::Log4perl->init('/etc/fonbotd/log4perl.conf'); |
26 | chdir '/var/lib/fonbot'; | |
27 | $_->init for PLUGINS; | |
28 | POE::Kernel->run; | |
8dc70d07 MG |
29 | } |
30 | ||
31 | sub finish{ | |
962dff7b | 32 | $_->fini for reverse PLUGINS |
8dc70d07 MG |
33 | } |
34 | ||
35 | 1; | |
36 | ||
37 | __END__ | |
38 | ||
39 | =head1 NAME | |
40 | ||
41 | App::FonBot::Daemon - FonBot daemon | |
42 | ||
43 | =head1 SYNOPSIS | |
44 | ||
45 | use App::FonBot::Daemon; | |
46 | App::FonBot::Daemon::run; | |
47 | END { App::FonBot::Daemon::finish } | |
48 | ||
49 | =head1 DESCRIPTION | |
50 | ||
51 | This module is the entry point of the FonBot Daemon | |
52 | ||
53 | =head1 FUNCTIONS | |
54 | ||
55 | =over | |
56 | ||
57 | =item B<run> | |
58 | ||
59 | Runs the FonBot daemon | |
60 | ||
61 | =item B<finish> | |
62 | ||
63 | Runs the plugin finalizers | |
64 | ||
65 | =back | |
66 | ||
67 | =head1 AUTHOR | |
68 | ||
69 | Marius Gavrilescu C<< <marius@ieval.ro> >> | |
70 | ||
71 | =head1 COPYRIGHT AND LICENSE | |
72 | ||
73 | Copyright 2013 Marius Gavrilescu | |
74 | ||
75 | This file is part of fonbotd. | |
76 | ||
77 | fonbotd is free software: you can redistribute it and/or modify | |
78 | it under the terms of the GNU Affero General Public License as published by | |
79 | the Free Software Foundation, either version 3 of the License, or | |
80 | (at your option) any later version. | |
81 | ||
82 | fonbotd is distributed in the hope that it will be useful, | |
83 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
84 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
85 | GNU Affero General Public License for more details. | |
86 | ||
87 | You should have received a copy of the GNU Affero General Public License | |
88 | along with fonbotd. If not, see <http://www.gnu.org/licenses/> | |
89 | ||
90 | ||
91 | =cut |