The problem with this, is that SUPER refers to the @ISA of the class it is COMPILED into, not the class of $self at runtime.
I'm not sure why you think this is "a problem".

This is the only sensible way for it to work.

You don't want to find the same named method in the superclasses of the object. You must find the same named method in the superclasses of the class in which you are compiled.

Consider X @ISA Y @ISA Z. Now, call method doit on an X, which isn't found, so we go up to class Y. In Y::doit, we want to call SUPER::doit. We cannot look at the @ISA of the object (which is an X), because that'll come right back around to us again! We must look in the @ISA of the class to which we belong (in this case, Y::doit), yielding a potential call to Z::doit.

So, if I'm following what you're trying to do, you'll be making classes that cannot be subclassed properly, because they'll be looking at the class of the object to get parents, not the "class" of the method. Broken.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.


In reply to Re: Using SUPER in dynamically generated subs by merlyn
in thread Using SUPER in dynamically generated subs by clinton

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.