Don't ask to ask, just ask | |
PerlMonks |
Re: How best to require subclasses at runtimeby impossiblerobot (Deacon) |
on Nov 08, 2002 at 03:06 UTC ( [id://211319]=note: print w/replies, xml ) | Need Help?? |
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
In Section
Seekers of Perl Wisdom
|
|