Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

That's really weird. That's "the can method that isn't in the current class". Unless you've implemented a local "can" method, that's gonna be UNIVERSAL::can.

You mean unless the superclass has implemented a local can method.

In any case, that is of course half my point. You are correct that the SUPER::can in my original example without package statements is relative to main, which I didn't realize. But that doesn't change anything about my claim that it dispatches to UNIVERSAL::can with $_[ 0 ] as the first parameter, which I identified as the cause for the infinite loop.

For some reason, you are saying that this reasoning is incorrect, but you haven't provided an alternative explanation. You then stated that SUPER is relative to the current package, which causes problems with code, although you made no explicit connection between the two facts.

I still don't see how my explanation can be wrong. Assuming no local implementations of can, Bar->SUPER::can( 'foo' ) is equivalent to UNIVERSAL::can( Bar => 'foo' ), which will find Bar::foo if there is one, not the foo in a superclass of Bar, despite the adornment with SUPER:: in the wrong place. And if I'm in Bar::foo to begin with, and goto myself, that's an infinite loop.

Makeshifts last the longest.


In reply to Re^7: goto superclass method by Aristotle
in thread goto superclass method by avarus

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-23 12:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found