Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Being helpful to a fault?

by Zero_Flop (Pilgrim)
on Dec 12, 2003 at 01:24 UTC ( #314196=note: print w/replies, xml ) Need Help??


in reply to Being helpful to a fault?

Just to respond on your first question. Yes, it is useful to load all of the modules in a directory. As Aristotle mentioned it is nice if you are working on a plugin system. I have seen this used particularly in IRC bots.

You do NOT do require XML::*, but rather you require all of the files in a program specific directory.

Normally once you require all of the modules, you run a setup routine in each file that generates hooks. Then in IRC as an example, when an event occurs all of the associated hooks in your hash are executed.

ex. You ask the bot what time it is. Clock module gets the local time of the requestor. if smart *ss module loaded, generate smart *ss responce if normal module loaded, generate normal responce.

Another nice benifit is you can dynamicly load and unload the modules without having to shutdown the bot. So you can administer the bot remotly.

Zero

Replies are listed 'Best First'.
Re: Re: Being helpful to a fault?
by graff (Chancellor) on Dec 12, 2003 at 04:32 UTC
    Thanks. My first question was in fact the one that mattered more to me. (I just couldn't seem to stop myself from going on to the second.)

    I also appreciated the comments by rchiavo and hardburn, who hit the crux of the matter pretty well: I confess to having been clueless about the mechanics of plugins, or how they would benefit from a design that says "load whatever exists in this path", and I should have just started with curiousity instead of criticism.

    But your reply was the first one to give some clues about plugins (which are still somewhat mysterious to me), and I'm grateful for that.

      Graff-

      Just for your information and so you can get a better feel to what this can do for you. Check out perlbot.org

      From the site:
      "Perlbot is a totally modular bot. All functionality is provided by Plugins which use a standard, simple API."

      Sorry I could not think of the name when I wrote the first note at work.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://314196]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (8)
As of 2021-10-22 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (85 votes). Check out past polls.

    Notices?