Bot-Net

 view release on metacpan or  search on metacpan

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

  on bot_message_to_me => run { ... };

It can also be used to yield messages:

  yield bot 'startup';

You may choose to use it or not.

=cut

sub bot($) { 'bot_'.shift }

=head1 setup

This method is called to tell the bot to startup. It finds all the mixins that have been added into the class and calls the L</setup> method for each.

=cut

sub setup {
    my $class = shift;
    my $self = bless {}, $class;

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

  on server_startup => run { ... };

It can also be used to yield messages:

  yield server 'startup'; # probably shouldn't actually do that

You may choose to use it or not.

=cut

sub server($) { 'server_'.shift }

=head2 setup

Setup the server and call all the mixin C<setup> methods.

=cut

sub setup {
    my $class = shift;
    my $self  = bless {}, $class;

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

        Bot::Net::Test->bots->{ $bot }{ 'ready' } = 0;
    }
};

=head2 on connect_after_bots

Checks to see if all the bots have spawned yet. If they have, then this emits C<bot connect> to connect the test bot (assuming the test is a test bot). If all the bots have not yet connected, then this will re-emit L</on connect_after_bots> to try ag...

=cut

sub _all_bots_are_ready() {
    for my $bot (keys %{ Bot::Net::Test->bots }) {
        my $status = Bot::Net::Test->bots->{ $bot };
        unless (defined $status and $status->{'ready'}) {
            return '';
        }
    }

    return 1;
}



( run in 0.259 second using v1.01-cache-2.11-cpan-65fba6d93b7 )