On 04/08/2010 05:46 AM, Dan Horne wrote:
HiI have a question regarding the best method for implementing application plugins - i.e. if there is an idiomatic way to do this in Moose. Here's a high level description of what I'm trying to achieve: 1. When the application starts, it finds all modules in a "plugins" directory. 2. We loop through each module in turn: 1. We call a register method, which registers the plugin (this method returns the plugin name). This becomes the key in the "plugins" hash 2. We then call a the plugin "functionality" method (I don't have a good name off the top of my head), which returns an anonymous sub containing the plugin functionality, (or perhaps a callback method name) 3. Now, whenever the plugin is called by name, the supplied "functionality"method is invoked I hope this makes sense Dan
http://search.cpan.org/~groditi/MooseX-Object-Pluggable-0.0011/lib/MooseX/Object/Pluggable.pm <http://search.cpan.org/%7Egroditi/MooseX-Object-Pluggable-0.0011/lib/MooseX/Object/Pluggable.pm>
-Sir
