[tpm] Understanding 'use base ...'
uri at stemsystems.com
Tue Jul 15 12:02:08 PDT 2008
>>>>> "SF" == Shaun Fryer <sfryer at sourcery.ca> writes:
SF> It was pointed out to me by a collegue a month or so ago after he spent
SF> a day tracking down strange inheritance related problems in a code base
SF> we were working on. It may be that there were other peculiarities to the
SF> environment which lead to the problem. I'll have to look into it a bit
SF> deeper I guess. Perhaps if it happens further up the inheritance chain
SF> that might have side effects? Hmm. Well, sorry for any confusion...
multiple inheritance can be wacky no matter how you set up @ISA. this is
why some langs disallow it altogether. the classic diamond pattern of
inheritance has serious issues (A inherits from B & C which both inherit
from D. does an inherited method call to A check B then D and then C or
B then C then D?)
but my point about use base vs. explicit assigning of @ISA stands. there
is no difference between them. use base is cleaner as it loads the
module and sets @ISA for you in one line.
Uri Guttman ------ uri at stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Free Perl Training --- http://perlhunter.com/college.html ---------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------
More information about the toronto-pm