in reply to Plugin Programming
I wish I could point you to some resources on the topic, but I can give you my experience with Perl and plugin development.
Generally, each plugin should have a single point of interaction with your program. Normally, this is a package that implements an interface specified by the application. Then the plugin can have its own set of supporting libraries.
So, you might have an interface that all plugins meet. The interface can be as simple as a list of methods that the plugin's implimentation class needs to support. However, you could provide a partial implimentation that can be subclassed by the plugin developer.
Here is an example of how you might load plugins in your application. In this example, each plugin is a PM file located in a directory called plugins.
sub LoadPlugins { my %plugins = (); for (<"plugins/*.pm">) { my ($pluginName) = /plugins/(\w+)\.pm/; require $_; # Create a new instance $plugins{$pluginName} = $_->new; } return %plugins; }
Now, this is a very simple example, but should get you started.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Plugin Programming
by gaal (Parson) on Feb 14, 2005 at 16:25 UTC |