The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl
use strict;
use warnings;
use utf8;
use File::Spec::Functions;
use FindBin;
use Config;

use lib File::Spec->catfile( $FindBin::Bin, 'lib');
use lib File::Spec->catfile( $FindBin::Bin, 'extlib/lib/perl5/');
use lib File::Spec->catfile( $FindBin::Bin, "extlib/lib/perl5/$Config{archname}");

use Encode;
use Carp;
use Getopt::Long;

use App::Mobirc;
use App::Mobirc::Util;

$SIG{INT} = sub { die "SIGINT!\n" };

my $daemonize_fg = false;
my $conffname = catfile($FindBin::Bin, 'config.ini');
my $version = false;
GetOptions(
    'daemonize' => \$daemonize_fg,
    'config=s'  => \$conffname,
    'version'   => \$version,
) or die "Usage: $0 -c config.ini";
Getopt::Long::Configure("bundling"); # allows -c -v

if ($version) {
    print "App::Mobirc/$App::Mobirc::VERSION\n";
    exit;
}

die "file does not exist: $conffname" unless -f $conffname;

DEBUG "load config: $conffname";
my $context = App::Mobirc->new(config => $conffname);

# daemonize
if ( $daemonize_fg ) {
    daemonize($context->config->{global}->{pid_fname});
}

$context->run;

exit 0;

__END__

=head1 NAME

mobirc - modern IRC to HTTP gateway

=head1 SYNOPSIS

   mobirc --config config.yaml

=head1 CONCEPT

easy hack, easy maintenance, modern style, easy to use for perl hackers.

=head1 HISTORY

mobirc is based on 'keitairc,v 1.33 2007/10/16 23:44:55 morimoto'.

=head1 LICENSE

This program is covered by the GNU General Public License 2