We agree on the important thing, but I feel I should clarify on the points where we don't seem to agree.

Your argument seems weak because AUTOLOAD will be smart enough to make the routine, but too stupid to know whether to use caller itself.

AUTOLOAD does not need to be smart in order to make the routine. It could be piecing them together from data provided to it (DATA handle, global variables, other functions). It can do this and still be dumb.

And though it may use caller, it need not know what the generated routine intends to do with this info. If each routine has its own needs, and AUTOLOAD needs to know it, using AUTOLOAD is a waste of time.

If this is debugging info there is no reason to avoid logging the AUTOLOAD call also.

Well, to avoid clogging the logs. If AUTOLOAD is called 30 000 times each day, but the select few routines we want to debug are called 20 times each day, it would be boring to leaf through that log. And a waste of disk space.

More, if several invocations of the same program log to the same file (as is commonly the case with CGI), it may not be easy to match the AUTOLOAD logging with the logging performed by the generated routine. While it can be done that way, you lose information.

If it is not debugging info, I don't see a reason to expose implementation details to users.

The routines generated need not just display the caller info. It could use it to provide different functionality (different access level or interface; whatever) depending on who called it.

So it is not just debugging info.

The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"


In reply to Re: AUTOLOAD and call tracing by Sidhekin
in thread oop - obvious AUTOLOAD question by princepawn

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.