in reply to Designing an OO program with multiple inherited classes
Hi
Regarding your update about $self->{foo} = $Obj::foo_cache{$id}; not working: that's because you've declared your 'cache' variables as 'my' variables, but refered to them as package variables. If you change the declaration to 'our' instead of my, it should work, I think...
About your design question, I'm no OO guru but using inheritance where it doesn't make sense I'm pretty sure is one the the things OO gurus go on about a lot. For reasons including:
For better explanations, consult an OO guru ;-)
For a more convenient way to dispatch methods off to a 'delegate' class, I suggest looking at a framework on top of Perl's bare object system. The most popular at the moment seems to be Moose, but I've not got round to using it so can't say for sure if it's best...
FalseVinylShrub
Disclaimer: Please review and test code, and use at your own risk... If I answer a question, I would like to hear if and how you solved your problem.
|
|---|