Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Object oriented plugin interface

by jackdied (Monk)
on Oct 30, 2001 at 04:43 UTC ( [id://122009]=note: print w/replies, xml ) Need Help??


in reply to Object oriented plugin interface

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://122009]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (2)
As of 2024-04-25 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found