Net::Ewtoo::Bot - a Ewtoo-compatible talker robot client module


        use Net::Ewtoo::Bot;

        my $NAME = 'jodbot';

        my $bot = new Net::Ewtoo::Bot;

        $bot->add_trigger("(.+?) says '$NAME, (.+?)'", \&handle_say);
        $bot->set_delay('range', 0, 5);

        $bot->login($host, $port, $user, $pass);
        $bot->say("Hi! I'm the $NAME robot!");




        sub handle_say {
                my ($sayer, $said) = @_;
                if ($said eq 'hello') {
                        $bot->say("Why hello $sayer!");
                } elsif ($said eq 'please go away') {
                        $bot->say("OK, bye!");


Net::Ewtoo::Bot provides an object-oriented interface to Ewtoo ( type talker systems. The module provides support for the most common Ewtoo talker commands, as well as input pattern matching and callback triggers and timers.


To install this package, just change to the directory which you created by untarring the package, and type the following:

        perl Makefile.PL
        make test
        make install

This will copy to your perl library directory for use by all perl scripts. You probably must be root to do this, unless you have installed a personal copy of perl.


        $bot->login($host, $port, $user, $pass);

This logs the bot into the $host:$port talker using $user and $pass. The bot will send extra carriage returns to bypass MOTDs and saved messages.

Any defined login subroutines are executed at this point.


Sends the "QUIT" command (in capitals for compatability with MBA4), and closes the socket. Any defined logout subroutines are executed beforehand. If $message is defined, the bot calls the "mquit" command with $message as its argument.

        $bot->set_delay($type, $lower, $upper);

This method sets the delay between between the calling of a method and its execution. This is useful for adding a realistic delay during communications with another user. $type can be either 'fixed', in which case the delay is always $lower (in seconds) and $upper is ignored, or 'range', in which case the delay will be a random number of seconds between $lower and $upper.

        $bot->add_trigger($pattern, $callback);

This method adds a trigger used by the listen() method. When a line of input is received that matches $pattern, $callback is executed. The arguments to $callback are any captured substrings you define in your pattern, which is a regular perl regexp (without the trailing and leading slashes).


Removes the trigger associated with $pattern from the trigger list.


Specifies a subroutine with $callback that will be executed after the bot logs in.


Specifies a subroutine with $callback that will be executed before the bot logs out.


listen() reads input from the talker and executes triggers as necessary. If $verbose is set to 1, then any input received is printed to STDOUT.


$break() sets a flag that tells the listen() method to finish and return.


A convenience function that makes the bot say $str.


A convenience function that makes the bot think $str.


A convenience function that makes the bot shout $str.

        $bot->tell($user, $str);

A convenience function that makes the bot tell $str to $user.


Allows the calling of an arbitrary talker command.


Reads a single line of input from the talker.


This module is (c) 2001,2002 Gavin Brown (, with additional input and advice from Richard Lawrence (

This module is licensed under the same terms as Perl itself.


Implement a timing mechanism for scheduled stuff.


The Ewtoo website at, and the PlayGround Plus website at