go ahead... be a heretic | |
PerlMonks |
OOP and import()by Herkum (Parson) |
on Dec 10, 2007 at 20:51 UTC ( [id://656224]=perlquestion: print w/replies, xml ) | Need Help?? |
Herkum has asked for the wisdom of the Perl Monks concerning the following question: I have some OO modules that I need to be declared in a particular order and must ensure that code is called in parent modules before being called in the modules that inherit from it. First is the basic Configuration module, it establishes a DBI connection so has to come first.
Next is my basic Object-Relational-Model code, it needs that DBI connection from the My::Config module to automatically run some code when it is initially used.
After 'using' the two previous modules, I want to run some more code in the Model.
I guess my question is, is import() being used in modules or is it like any other subroutine, I would have SUPER my way down the Config module to ensure that everything gets called in proper order? OR? Is there another approach that I am missing that I should try? When these modules are use'd I only need the code to be run once; (for example, I don't constantly need to create a DBI connection once I have one.
Back to
Seekers of Perl Wisdom
|
|