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