more useful options | |
PerlMonks |
Dynamic loading of object-oriented pluginsby Erik Hensema (Sexton) |
on Oct 24, 2001 at 01:21 UTC ( [id://120920]=perlquestion: print w/replies, xml ) | Need Help?? |
Erik Hensema has asked for the wisdom of the Perl Monks concerning the following question: I'm trying to develop an application which is able to dynamically load plugins. These plugins are objects (packages). I've got some code working, but I've got the feeling it's not the prettiest of all scripts :-/ Basically my in the main package I load the plugins by calling require. The plugins then register themselves to the main package by calling this function:
A plugin basically looks like this:
Then this works from main:
I think it's quite ugly to return the package name as a string to main. Isn't there some other way, preferably using a reference or something like that?
Back to
Seekers of Perl Wisdom
|
|