In article < lo.EDU>,
Vikas <> wrote:
> I have been programming in Perl for long and at number of places I come
> across modules which say they follow a plugin framework and anyone can
> plug their plugins (codes) into their software.
>
> Can anyone give me pointers as to how to develop such a software which
> supports plugin framework . I mean can I read articles or tutorials about
> it somewhere?
I don't know of any good tutorials etc on the subject but here's what
general info I've learnt about such plugin architectures from building
and using them:
* plugins are loaded on demand
* plugins are generally best modelled as classes, so you load the plugin
class and instantiate a plugin object of that class
* plugins conform to a specified API. Some methods may be mandatory,
some may be optional, and so on, but there must be some standard to work
with
* the API can be as simple or as complex as you need. One class of
plugins I wrote has one constructor method (returns a new object), and
one object method (returns 1 or 0)

* Inheritance can be very useful. E.g. an X::Y factory class produces
X::Y::Foo and X::Y::Bar (etc..) objects, and those objects inherit some
methods from X::Y, maybe things such as debugging routines, file I/O,
and so on.
If you've got any more details about the kind of plugins and application
you want to write there's probably some more specific pointers.
P
--
pkent 77 at yahoo dot, er... what's the last bit, oh yes, com
Remove the tea to reply