If you can trust your users (or if you can trust them to secure their machines properly), a clean way to do this is to let your application have a "plugins" directory full of simple Perl modules all adhering to a common interface, and then require each of these modules. Each plugin module could have a method called "make_callback" (or equivalent), and they would be all properly namespaced and sorted.
Then you will need some way to instantiate them and add them to a list of active plugins, but this should be left as an exercise to the reader (it's simple enough).
But in general, unless you are writing something like the GIMP or PhotoShop or an Application Server, it might be best to not have users write code to modify the way your program works. Depends what you are doing, of course, there may be moer usable/friendly ways. Meanwhile, if I'm installing a Wiki or something, I have no problem editing perl config files, it's just horrific if you mess one up because you'd get a syntax error or some obscure runtime error rather than the application telling you what's up as part of a config file verification process. So avoid making users write code if you can help it (some don't even know what '$' means!)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.