Bot-Net

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

      generic base configuration for new bots and test bots.
    * Added the ability to store the configuration in a package variable named
      $CONFIG as an alternative to a YAML configuration file.
    * Added Bot::Net::Test for helping built bot net application tests.
    * Added a t/TestNet/t/count.t test to the framework.
    * Some other clean-up, documentation updates, and minor fixes as well.

0.0.1 Sun Oct 7 20:07:47 2007
    * Initial release of Bot::Net.
    * This is a refactoring of a tool I used internally to build a nice bot net
      for synchronization. It still has some left overs from the old country
      that need to be brought into the new system fully, but the new system
      works and is superior to the old one.
    * Bot::Net class as the central singleton.
    * Bot::Net::Bot class as the main mixin implementation for building bots.
    * Bot::Net::Config class to load and find configuration files.
    * Bot::Net::Log class to handle loging via Log::Log4perl
    * Bot::Net::Message class for encapsulating bot messages.
    * Bot::Net::Mixin::Bot::IRC class for making IRC bots.
    * Bot::Net::Mixin class for building mixins to add features to bots and
      servers.

inc/Module/Install.pm  view on Meta::CPAN

#     1. Makefile.PL calls "use inc::Module::Install"
#     2. $INC{inc/Module/Install.pm} set to ./inc/ version of Module::Install
#     3. The ./inc/ version of Module::Install loads
# }

use 5.004;
use strict 'vars';

use vars qw{$VERSION};
BEGIN {
    # All Module::Install core packages now require synchronised versions.
    # This will be used to ensure we don't accidentally load old or
    # different versions of modules.
    # This is not enforced yet, but will be some time in the next few
    # releases once we can make sure it won't clash with custom
    # Module::Install extensions.
    $VERSION = '0.64';
}

# Whether or not inc::Module::Install is actually loaded, the
# $INC{inc/Module/Install.pm} is what will still get set as long as

lib/Bot/Net.pm  view on Meta::CPAN

=item *

A verification system for telling you whether or not your bots will talk to each other without getting confused or fail.

=back

=head2 WHY?

First, because breaking certain tasks into small hunks that can be handled by semi-autonomous agentsis a handy way to think about some problems. 

The original problem I wrote this system for is to handle the synchronization of data between lots of hosts. I had bots for pulling bits of data from each host, other bots for pushing bits of data back to each host, bots for pulling data from one hos...

It quickly became a pain, so I built this to take away the pain.

Previously, I wrote another system, L<FleetConf>, to handle a very similar task. However, I am not very happy with how that turned out, so learning from my work there, I've built this system.

=head1 THIS OBJECT

This is the central singleton providing some basic services used by just about everything in the L<Bot::Net> system.

=head1 METHODS

lib/Bot/Net/Bot.pm  view on Meta::CPAN

Bots should implement this event to perform any startup tasks. This is bot-specific and mixins should not do anything with this event.

=head2 on bot quit MESSAGE

Bots may emit this state to ask the protocol client and all resources attached to the bot to close. The C<MESSAGE> parameter allows you to pass a human readable message that can be passed on as part of the protocol quit or logged or whatever...

If all mixins are implemented correctly, this should very quickly result in the bot entering the L</on _stop> state and L</on bot shutdown>. (If not, the bot may be stuck in a sort of zombie state unable to die.)

=head2 on bot shtudown

This is called (synchronously) during teh L</on _stop> handler immediately before shutdown to handle any last second clean up.

=head1 MIXIN STATES

The base mixin handles the following states.

=head2 on _start

Performs a number of setup tasks. Including:

=over

lib/Bot/Net/Bot.pm  view on Meta::CPAN

            push ( @output, "'$_'" );
        }
        $arg_number++;
    }
    $log->debug("$event ". join( ' ', @output ));
    return 0;    # Don't handle signals.
};

=head2 on _stop

This calls (synchronously) the L</on bot shutdown> state, to handle any final clean up before quitting.

=cut

on _stop => run {
    call get(SESSION) => bot 'shutdown';
};


=head1 AUTHORS

lib/Bot/Net/Server.pm  view on Meta::CPAN

This is yielded at the end of the L</on _start> handler for the L<POE> session. Your server should perform any initialization needed here.

=head2 on server quit

A server should emit this state when it wants the server to disconnect and shutdown. If all mixins are implemented correctly, they should listen for this state and close all resources, which should result in the server going into the L</on _stop> sta...

This should be used by protocol mixins to implement the shutdown sequence for their listening ports, open files, etc.

=head2 on server shutdown

This is called synchronously at the end of the L</on _stop> handler for the L<POE> session. 

=head1 POE STATES

=head2 on _start

Handles session startup. At startup, it loads the information stored in the configuration file and then fires L</on server startup>.

=cut

on _start => run {

lib/Bot/Net/Server.pm  view on Meta::CPAN

            }
            $msg .= "'$_' ";
        }
    }
    recall('log')->debug($msg);
    return 0;    # Don't handle signals.
};

=head2 on _stop

This calls (synchronously) the L</on server shutdown> state, to handle any final clean up before quitting.

=cut

on _stop => run {
    call get(SESSION) => server 'shutdown';
};

=head1 SEE ALSO

L<Bot::Net::Mixin::Server::IRC>



( run in 0.264 second using v1.01-cache-2.11-cpan-0d8aa00de5b )