2xlp has asked for the wisdom of the Perl Monks concerning the following question:
I've got an OOP project that has a superclass
The questions I have are this:
and many variantspackage Language; 1;
I need to have a unified function in superclass that can figure out which SubClass is most appropriatepackage Language::English; 1; package Language::French; 1; package Language::Italian; 1;
and each of the subclasses would have some standard interface , or make regext available, etc...package SuperClass; sub derive_subclass_for_word { my ($word)= @_; # test against a regex found in each language, or something like tha +t my $language; return $language; } 1;
The questions I have are this:
- how the do i best register the subclasses with the super? (so the super knows what it can inspect. is this a begin block code? )
- I'd like ( if possible ) to just include the Super - then it looks for subclasses and includes the entire lot. if needed, I could just have the super include every sub - but i'd like to automate this if possible
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Registering Subclass Modules via Plugin
by dragonchild (Archbishop) on Nov 14, 2007 at 18:45 UTC | |
by 2xlp (Sexton) on Nov 14, 2007 at 19:08 UTC | |
by dragonchild (Archbishop) on Nov 14, 2007 at 19:35 UTC | |
Re: Registering Subclass Modules via Plugin
by philcrow (Priest) on Nov 14, 2007 at 19:12 UTC | |
by 2xlp (Sexton) on Nov 14, 2007 at 20:11 UTC | |
Re: Registering Subclass Modules via Plugin
by sundialsvc4 (Abbot) on Nov 15, 2007 at 02:50 UTC |
Back to
Seekers of Perl Wisdom