let say we have:
use Parent;
use Parent::Child;
use Parent::Child::Granchild;

In Parent we have an AUTOLOAD method catching setters and getters for example.
If we have a Parent::Child::Granchild::AUTOLOAD method,
it will catch the non defined methods for Parent::Child::Granchild objects. If nothing is done in the lower AUTOLOAD howto get the upper one to try before giving up.

I tried in Parent::Child::Granchild

sub AUTOLOAD {
my $self=shift;
.....
if (we should do something here){
     we do it;
     return something;

}
else {
    return $class->SUPER::AUTOLOAD();
}
This works but we loose the CONTENT of $AUTOLOAD coming in Parent::AUTOLOAD.

Im'not very satisfied with this solution.
Is there some nicer way to do this and let Perl do the search for AUTOLOADS upwards?


In reply to More then one AUTOLOAD in a class hierarchy. by ced

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.