View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Andrew Sterling Hanenkamp > Bot-Backbone-0.112500 > Bot::Backbone::Bot



Annotate this POD


Open  0
View/Report Bugs
Module Version: 0.112500   Source   Latest Release: Bot-Backbone-0.161950


Bot::Backbone::Bot - Provides backbone services to your bot


version 0.112500


  my $bot = My::Bot->new;


When you use Bot::Backbone in your code, you get a bot implementing this role. It provides tools for constructing, executing, and shutting down services.



Bots do all their work using an event loop. Usually, this is either POE or AnyEvent. Fortunately, these event loops tend to work well together in case you need both. Just in case you need specialized startup for your bot's event loop, though, this is attribute is provided to allow the event loop startup to be customized.

This is an object or class on which you may call a run with no arguments. It will be called to start the event loop. By default, this is just "POE::Kernel". It is expected that this method will block until the bot is shutdown.


This is a hash of constructed services used by this bot. There should be a key in this hash matching every key in the same attribute in Bot::Backbone::Meta::Class, once "run" has been called.



Returns itself.



This method iterates through the service configurations of the meta class and constructs each service from that configuration.

You may run this prior to "run" to construct your services prior to running. Normally, though, this method is called within "run".



This starts your bot running. It constructs the services if they have not yet been constructed. Then, it initializes each service. Finally, it starts the POE event loop. This last part really isn't it's business and might go away in the future.

This method will not return until the event loop terminates. The usual way to do this is to call "shutdown".



You may call this at any time while your bot is running to shutdown all the services. This notifies each service that it should shutdown (i.e., finish or terminate any pending jobs in the event loop). It then clears the "services" hash, which should cause all services to be destroyed.


This thing sort of kind of needs POE to be any kind of useful. However, POE seems to have weird drawbacks. I have some planned work-arounds for this being an explicit and required dependency, but it's there for now.

Second, if you use the Jabber chat service, you need AnyEvent. Mostly, AnyEvent and POE seem to get along, but it's slow and I've found that timers, in particular, just plain don't work quite right.

Finally, in order to marry AnyEvent and POE in a way that is faster and seems to work more consisently, I also require the use of POE::Loop::EV, which, of course, depends on EV. If that's a problem for you, drop me a line or submit a patch and we'll see if we can work this problem out.


Andrew Sterling Hanenkamp <>


This software is copyright (c) 2011 by Qubling Software LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: