Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How best to require subclasses at runtime

by impossiblerobot (Deacon)
on Nov 08, 2002 at 03:06 UTC ( [id://211319]=note: print w/replies, xml ) Need Help??


in reply to How best to require subclasses at runtime

If I understand your problem correctly, this seems to be a good use for Class::Factory.

It provides a subclassable interface for creating factory classes, and allows for lazy loading of the various modules. (A factory method basically exists to instantiate objects without having to know which object you are going to instantiate ahead of time. Class::Factory helps to create Abstract Factory classes containing methods that other classes can call. It then returns the proper type of object based on how it is called.)

(I'm sorry if this isn't very clear; I'll think about how I can reword it.)

Update: Added to explanation of factory methods/classes.

Update: The explanation of the Abstract Factory pattern at the Wikipedia is probably better than what I could come up with. :-)


Impossible Robot
  • Comment on Re: How best to require subclasses at runtime

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-09-08 00:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.