XP is just a number | |
PerlMonks |
Re: Re: Coding perl a plugin system?by tachyon (Chancellor) |
on Dec 16, 2002 at 00:08 UTC ( [id://220083]=note: print w/replies, xml ) | Need Help?? |
If you want to do stuff C++ OO style in perl here is one way to do it. The basic API spec is as follows: A plugin must supply three methods, namely func1(), func2() and func3(). The plugin code is expected to be OO as shown in the sample code and nothing should be exported from it. These methods do foo bar and baz (ie take the following args, set whatever widgets, return whatever) To enable the plugin methods to do foo bar and baz access to the configuration variables $var1, $var2, $var3 is provided via get and set methods. The MP3 package also provides the following utility methods blah.... With the vars in the MP3 package the closures mean using the set and get methods is the only way to set/get these vars. You can thus impose whatever level of sanity checking you like on what happens to them (from your code or the Plugin). By making the plugin OO you don't have to worry about namespace polution and you can pass initializing config data to it if required
cheers tachyon s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In Section
Seekers of Perl Wisdom
|
|