Hi everyone,

I've run into a problem that I'm not quite sure how to describe.

In essence, I think I'm looking for a SUPRA class -- sort of a reverse of SUPER. Here's what I am trying to do: I have a child class that only has a subset of the methods of its parent. So let's say method finalize is called. It ends up going to the parent class.

This is where things get tricky. finalize calls another one of the class's methods, finalize_body. And, while the parent class has a finalize_body, so does the child class. Assuming the child class has a finalize_body method, I would like to move back to the child class and not use the parent's method.

Yet, I haven't been able to think of a way to do this without explicitly naming the child package. Moreover, I'd like for it to be setup in such a way where if the child does not have a finalize_body class, it will move down the tree of inheritance normally and use the parent's method instead.

Does that make sense? Is there a simple way to do what I'm trying to do?

Thanks for your help!


In reply to Supra Class for Inheritance? by tbutler

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.