We don't bite newbies here... much | |
PerlMonks |
Re: Object oriented plugin interfaceby jackdied (Monk) |
on Oct 30, 2001 at 04:43 UTC ( [id://122009]=note: print w/replies, xml ) | Need Help?? |
Is there any reason you are passing in the sub? If you wanted to be somewhat OO, there should be a sub named callback() in each package. Perl doesn't have pure virtual objects (for C++ folk) or interfaces (for Java junkies), but you could pretend that each plugin adheres to an imaginary parent object. If you wanted to make a real parent that calls die() for every sub, that works too. If you wanted to be very OO, you could have the callback sub return a ref to an object of the plugin derived object. Your milage may vary If you go with the package name instead of coderef, check out This node for a short example of plugin::register(). -jackdied
In Section
Cool Uses for Perl
|
|