=head1 NAME Evalbot =head1 DESCRIPTION This is a small IRC bot using C to C commands. =head1 ARCHITECTURE C is the main bot, written in Perl 6. To run a command, it spawns C, a Perl 5 program. This sets up the necessary environment (C, redirection of C and C to a temporary file, resource limits, etc.). Finally, C runs C. =head1 INSTALLATION There's no separate installation step needed, simply run C and supply a nick and an IRC server to connect to: $ pugs evalbot.pl evalbot6 irc.freenode.net:6667 To invite the bot to a channel, msg the bot from your IRC client: /msg evalbot6 ?join #channelname For #perl6, there is a special auto-upgrading version of the bot that restarts when pugs on feather recompiles. To start this process: $ perl examples/network/evalbot/evalbot-loop It will automatically join #perl6 on freenode.irc.net. You don't have to restart C when you install a new Pugs, as a new C is spawned on each command to eval. C needs the C module to be able to set appropriate resource limits, so you can't run Evalbot under Win32. =head1 REMOTE CONTROL Once C is connected to IRC, everybody can send it expressions to eval: ?eval 42 42 Because of C and Pugs's safemode, Evalbot should be able to withstand most attacks (infinite loops, huge memory consumption, unsafe I/O, etc. etc.): ?eval while 1 {} ?eval my $str = "42" x 1_000_000_000_000 ?eval system "rm -rf /" ?eval say "\nPRIVMSG foo :bar" ?eval say "flood\n" x 1_000 # etc. Note that the return value of an expression is not printed directly, but instead the C<.perl> method is called to prettyprint the result: ?eval "hi" 'hi' # (note that quotes) This behaviour may be confusing at first, especially if you intended to use C<&say> to output something: ?eval say "hi" hi Bool::True # (the Bool::True is say("hi")'s return value) There're other commands available, too: ?help evalbot6 -- ?help | ?quit [reason] | ?raw ... | ?join #chan | ?uptime | ?eval code =head1 AUTHOR Ingo Blechschmidt, Ciblech@web.deE>