in reply to Thorny design problem

I'd use the eval, but only for the require. I'd use $module->doIt() or, more likely, $module->new(...) followed by some other method calls.

Note that I'd likely not use inheritance to factor out commonality here. I encourage you to try to factor out common parts, but by making modules that your main modules use, not modules that your main modules try to BE (as in @ISA).

Your situation sounds like a nearly perfect situation for discovering how inheritance binds so tightly and can leave you in a bind. But learning that from reading instead of from personal, painful experience is a sign of intelligence. (:

- tye        

  • Comment on Re: Thorny design problem (eval++, OO++, ISA--)

Replies are listed 'Best First'.
Re^2: Thorny design problem (eval++, OO++, ISA--)
by jimX11 (Friar) on Sep 09, 2005 at 16:16 UTC

    I'm reading Head First Design Patterns, which says to favor composition over inheritance. Encapsulate what changes, but there are other ways to do that besides inheritance, like delegation. What you say, Tye, reminds me of what I've read.