Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 105 lines (74 sloc) 2.2 KB
#!/usr/bin/perl
# infobot -- copyright kevin lenzo (c) 1997-infinity
# Flooterbuck Infobot -- copyright (C) Dave Brown, 2001-2004
# For full licensing terms see the file LICENSE included with
# the flooterbuck distribution.
require 5.6.0;
BEGIN {
$VER_MAJ = 1;
$VER_MIN = 2;
$VER_MOD = 1;
$version = "Flooterbuck infobot $VER_MAJ\.$VER_MIN\.$VER_MOD [dagbrown]";
}
BEGIN {
$filesep = '/';
# set this to the absolute path if you need it; especially
# if . is not in your path
$param{'basedir'} = ( $0 =~ /(.*)$filesep/ ) ? $1 : '.';
# $infobot_base_dir = '/usr/local/lib/infobot';
# change this next line if you run a local instance of
# an infobot and use the code from the main location.
# the 'files' directory contains infobot.config and
# infobot.users, among other things.
$param{'confdir'} = "$param{basedir}${filesep}conf";
# everything is loaded, then the variables that
# you want to set will override the defaults; this
# is why all these requires are here.
$param{'srcdir'} = $param{'basedir'} . $filesep . "src";
opendir DIR, $param{'srcdir'}
or die "can't open source directory $param{srcdir}: $!";
while ( $file = readdir DIR ) {
next unless $file =~ /\.pl$/;
require "$param{srcdir}$filesep$file";
}
closedir DIR;
}
# get the command line arguments
&getArgs();
# initialize everything
&setup();
# launch the irc event loop
&irc();
exit 0; # just so you don't look farther down in this file :)
# --- support routines
sub usage {
print "\n";
print " usage: $0 [-h] [<config file>]\n";
print "\n";
print " -h this message\n";
print "\n";
}
sub getArgs {
if ( $ARGV[0] ) {
if ( $ARGV[0] =~ /^-[hi\?]/ ) {
&usage;
exit 1;
}
else {
$paramfile = $ARGV[0];
}
}
else {
$paramfile = '';
}
}
1;
__END__
=head1 NAME
Flooterbuck Infobot - a modular IRC information bot
=head1 SYNOPSIS
B<infobot> S<[ -h ]> [I<paramfile1> [I<paramfile2> ...]]
=head1 NOTE
If you're reading this, you need to yell at
Dave Brown (flooterbuck@dagbrown.com)
and tell him to write some actual documentation. =)