Bot-Net

 view release on metacpan or  search on metacpan

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


  cd MyBotNet
  bin/botnet run --server Main
  bin/botnet run --bot SomeBot

To create a new L<Bot::Net> application:

  bin/botnet net --name MyBotNet

TODO XXX FIXME Document automatic creation of new bots and servers...

If you're developing a new bot or something, you might find these useful:

  Bot::Net->log->debug("Debug message.");
  Bot::Net->log->error("Error message.");

  my $value = Bot::Net->config->bot('MyBot')->{'config'}{'value'};

=head1 DESCRIPTION

B<EXPERIMENTAL:> This module has just barely left the proof-of-concept phase. Much of the API is fluid and changing. If you're interested in contributing, please contact me at my email address at the bottom.

A nice way to create bots, networks of bots, and servers that run them. Currently, this system only provides tools for building IRC bots, but additional protocols could be added in the future. The aim is not to tie the system to any one architecture ...

=head2 GOALS

The aim of this system is to provide a tool for creating a botnet for handling parallel tasks with communication primarily happening over IRC. The eventual goals of the system include:

=over

=item *

Provide easy to build and easy to understand mechanisms for building semi-autonomous agent-based systems (bots).

=item *

Automatically build the scaffolding for a L<Bot::Net> application, automatically create stubs for bots and servers, and generally give you some tools to get started quickly.

=item *

Provide a declarative syntax for creating bots and bot components.

=item *

Tools for initializing and managing the lifecycle of all your bots.

=item *

A server environment for helping you run your bots on one or more hosts that can communicate with one another.

=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

=head2 bot_net

Returns the singleton object. Usually, you don't need to call this directly since all the L<Bot::Net> methods call this internally.

=cut

sub bot_net {
    my $class = shift;
    unless ($class->_bot_net) {
        $class->_bot_net(bless {}, $class);
    }
    return $class->_bot_net;
}

=head2 config

Return the configuration data for this application instance. See L<Bot::Net::Config> for additioanl details.

=cut

sub config {
    my $class = shift;
    my $self  = $class->bot_net;

    if (not defined $self->{config}) {
        $self->{config} = Bot::Net::Config->new;
    }

    return $self->{config};
}

=head2 log NAME

Retrieves a logger object for this application. If given a name, it will return a specific named logger. Otherwise, it returns the application default logger, named "Bot::Net".

See L<Bot::Net::Log>.

=cut

sub log {
    my $class = shift;
    my $self  = $class->bot_net;
    my $name  = shift || eval { Bot::Net->config->net('ApplicationClass') } 
                      || 'Bot::Net';

    if (not defined $self->{log}) {
        $self->{log} = Bot::Net::Log->new;
    }



( run in 1.009 second using v1.01-cache-2.11-cpan-e1769b4cff6 )