in reply to Re: SUPER delegation fails because class name getting munged (somehow?)
in thread SUPER delegation fails because class name getting munged (somehow?)

How is that a bug? My expectation would always be that SUPER is resolved in the context of the current package and that is the way it is documented in perlboot and perltoot along with pretty much anywhere else I've seen it mentioned in documentation.

True laziness is hard work
  • Comment on Re^2: SUPER delegation fails because class name getting munged (somehow?)

Replies are listed 'Best First'.
Re^3: SUPER delegation fails because class name getting munged (somehow?)
by bpphillips (Friar) on Feb 25, 2011 at 03:34 UTC

    This was actually something that I've never really thought about and at first blush was surprising (although given five minutes of thought, it makes perfect sense). The fact that $class->SUPER::method() doesn't consider the value of $class at all could be unexepected since in typical use, the method is resolved relative to the invocant. Moose's bare super keyword avoids any confusion by removing the invocant altogether. This makes it (virtually) impossible to try and call some other class's (or object's) parent method via SUPER (or super in Moose's case).