This is just an example, right, that you've given us? Because I'm just wondering why you have the statements like
if ($fname eq 'foo') { ... }
etc. You're not going to put in statements like that for every possible method that you're trying to trap in the AUTOLOAD, are you? Because that kind of defeats the purpose of having an AUTOLOAD method--if you're just testing for specific methods, why not define them in the first place?

This has a point, because my contention is that the example you've given us isn't all that helpful. AUTOLOAD should trap any methods that you don't explicitly handle in your code; so in package B, how do you know when you should pass a certain method on to A's AUTOLOAD? You're not just planning on explicitly testing for all of those cases in B, are you?

I'd like to get a better idea of what you're trying to do, because it's possible that you're asking an XYZ question. In other words, perhaps there's another way to do what you're doing, but I don't know what it could be, because I don't know what you're trying to do.


In reply to Re: AUTOLOAD functions & inheritence by btrott
in thread AUTOLOAD functions & inheritence by LunaticLeo

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.