[tpm] Understanding 'use base ...'

Shaun Fryer sfryer at sourcery.ca
Mon Jul 14 14:13:31 PDT 2008

Hi Madi,

I see you already answered your own question, but I'd like to add something
which may not be documented (haven't checked). Unlike @ISA, "use base" does
not respect order of inheritance. While generally multiple inheritance is a
bad idea, it's difficult to get around at times due to the widespread use in
many common Perl modules of "implementation inheritance", versus the much
better and more flexible "interface inheritance" pattern. So while, @ISA
stores the inheritance chain in a fixed "ordered list", "use base" does not
respect the order of inheritance, which can pose problems and produce many
intermittent so called "heisenbugs".

Have fun! :)


On Mon, Jul 14, 2008 at 02:53:59PM -0400, Madison Kelly wrote:
> Hi all,
>   I am working on some docs, and noticed that a module is called via:
> use base qw(Net::DBus::Object);
>   I am trying to understand the 'use base' syntax, and all I've been 
> able to find in perldoc is in perlmodlib:
> base        Establish IS-A relationship with base classes at compile time
>   Can someone either explain to me what this means, or better, point me 
> at what docs explain "IS-A relationship"s? I hate "just accepting" that 
> something is at it is. Probably why I never get anything actually done. :)
>   Thanks as always!
> Madi

More information about the toronto-pm mailing list