#!/usr/bin/env perl # VladimirBot is my information robot. This is the back-end which actually does # stuff, but I will also make front-ends such as AIM, email, and command line. # # See my wiki (http://thelackthereof.org/wiki.pl/VladimirBot) for a high-level # discussion of what Vladimir is and what Vladimir could one day be. # # History/Notes # 2003.12.22 # - This will now only be used by a main-entrypoint. It will be a daemon # which lets things connect to it via TCP sockets. # - Right now each module registers itself through a global. I might change # this so that they instead register in an OO callback sort of way. # 2003.09.23 # - Removed state machine, switching to linear module calls # Each module then can parse the sentence however it likes # - Idea: Run the sentence through an analyzer... break it into subjects # and nouns and such. Then give the modules access to these results # 2003.09.17 # - Added history # - Continue to split into modules package VladimirBot; use strict; # This will provide a var for modules to register use vars qw( @vladimir_module ); # And the VladimirBot Modules #use VladimirBot::Movies; use VladimirBot::News; use VladimirBot::ScheduleII; #use VladimirBot::Schedule; use VladimirBot::Math; use VladimirBot::Chat; use vars qw( %extra ); my $debug = 0; sub process { my ($from, $msg, $ex) = @_; my $out; print "Got msg from $from\n"; foreach my $mod (@vladimir_module) { print "Trying $mod...\n"; my $out = eval("VladimirBot::" . $mod . "::parse(\$msg)"); print "Error: $@\n" if $@; return $out if $out; } return "?"; } # We're coo. 1;