in reply to Re: tracing SUPER
in thread tracing SUPER

I may be confused about how delegation works, now that I think about it more. When something has @ISA = qw(Foo::Bar), the only thing it checks other than itself is Foo::Bar? Or does it look for anything else that isa(Foo::Bar) and call the method there as well? If that's the case, then I think it's failing altogether; We have a bunch of code that @ISA = qw(Foo::Bar) but there is no Foo/Bar.pm; it's just a convenience. If that is the case (you use SUPER, but one of your @ISA's doesn't exist), does it return a false value?

Replies are listed 'Best First'.
Re^3: tracing SUPER
by gaal (Parson) on Jul 28, 2004 at 18:52 UTC
    Inheritance goes one way: up. If B and C are both As, and C->meth is called but C doesn't define a meth, B will certainly not be called! Why should it; after all, C is not a B.

    But you say you have "a bunch of code that @ISA = qw(Foo::Bar) but there is no Foo/Bar.pm; it's just a convenience". Convenience for what? It's wrong semantically to inherit from something that doesn't exist.

    Note that not having a file Foo/Bar.pm is perfectl all right: Foo::Bar may be defined in another file, or created on the fly at run time. So long that it is compiled before you call any of its methods, you are syntactically safe. You'd better make sure it finishes compiling before its subclasses are defined too, unless you know what you're doing (== funky dynamic stuff)