X-Git-Url: http://git.annexia.org/?p=xavierbot.git;a=blobdiff_plain;f=xavierbot.pl;h=230612b943b1091c3bb0a94688068165c7cd4ff7;hp=7601136c1be0db899a05c3778c33e351cb9f15b6;hb=999637103a46eed68aa5051dd23f0ce0a3daf92e;hpb=1e6d6c08bec29a317316f107b7d9bde285c1f798 diff --git a/xavierbot.pl b/xavierbot.pl index 7601136..230612b 100755 --- a/xavierbot.pl +++ b/xavierbot.pl @@ -2,14 +2,11 @@ # xavierbot : an OCaml interpreter IRC bot. # By Richard W.M. Jones . # This code is in the Public Domain. -# $Id: xavierbot.pl,v 1.4 2007/06/28 20:49:10 rjones Exp $ +# $Id: xavierbot.pl,v 1.5 2007/06/28 23:18:28 rjones Exp $ use strict; - use POE qw(Component::IRC Wheel::Run); -$ENV{PATH} = "/usr/bin:/bin"; - #---------------------------------------------------------------------- # Start of configuration. @@ -23,6 +20,8 @@ my $channel = "#ocaml"; # End of configuration. #---------------------------------------------------------------------- +$ENV{PATH} = "/usr/bin:/bin"; + POE::Session->create ( package_states => [ main => [ qw(_default _start irc_001 irc_public got_stdout) ], @@ -81,9 +80,11 @@ sub irc_public print "got: $what\n"; if (my ($stmt) = $what =~ /^\s*([^#].*;;)\s*$/) { - print "stmt = $stmt\n"; $heap->{ocaml}->put ("$stmt\n"); } + elsif ($what =~ /$nick.*restart/) { + print STDOUT "got instruction to restart ...\n" + } undef; }