use strict;
use warnings;
-our $log = new Keitairc::Log();
our $cf = new Keitairc::Config({version => '2.1a1', argv => \@ARGV});
-$log->config($cf);
-our $ib = new Keitairc::IrcBuffer({history => $cf->web_lines()});
-our $sm = new Keitairc::SessionManager({default_ttl => $cf->session_ttl()});
-our $pl = new Keitairc::Plugins({config => $cf});
# daemonize
if($cf->daemonize()){
- use Proc::Daemon;
-
- Proc::Daemon::Init;
- if(length $cf->pid_dir()){
- if (open(PID, '> ' . $cf->pid_dir() . '/' . $cf->pid_file())) {
- print PID $$, "\n";
- close(PID);
+ if (eval 'require Proc::Daemon') {
+ require Proc::Daemon;
+ Proc::Daemon::Init();
+ if(length $cf->pid_dir()){
+ if (open(PID, '> ' . $cf->pid_dir() . '/' . $cf->pid_file())) {
+ print PID $$, "\n";
+ close(PID);
+ }
}
+ $poe_kernel->has_forked if ($poe_kernel->can('has_forked'));
+ } else {
+ warn('Proc::Daemon module is not installed, could not daemonize');
}
- $poe_kernel->has_forked if ($poe_kernel->can('has_forked'));
}
+our $log = new Keitairc::Log({config => $cf});
+our $ib = new Keitairc::IrcBuffer({history => $cf->web_lines()});
+our $sm = new Keitairc::SessionManager({default_ttl => $cf->session_ttl()});
+our $pl = new Keitairc::Plugins({config => $cf});
+
# create irc component
our $irc = POE::Component::IRC->spawn(
Alias => 'keitairc_irc',
}
################################################################
-sub action_public{
+sub action_public {
my $request = shift;
my $uri = shift; # such as '/favicon.ico'
my $ci = new Keitairc::ClientInfo($request);
my $view = new Keitairc::View($cf, $ci);
- return $view->public($uri);
+ return $view->public($request, $uri);
}
################################################################