You're kidding, right??!!
Of course, you're not kidding, because it works just fine. If someone could point me toward an explanation of why that works, I'd be very grateful.
It seems that my "just type and hope Perl figures it out" approach was closest, but I couldn't get a permutation of $class->SUPER::$meth to compile. | [reply] [d/l] |
$ perl -le " q/warn/->( 6,6 ) "
Undefined subroutine &main::warn called at -e line 1.
$ perl -le " sub warn { die @_ } q/warn/->( 6,6 ) "
66 at -e line 1.
Modern Perl, references quick reference /Re (tilly) 1: References quick reference | [reply] [d/l] |
I guess what I was missing is that "SUPER" isn't as magical as I thought. I understand that $c->$m($x) is just $m($c, $x) but I was reading "SUPER" as somehow being associated to the class, not being part of the method. To abuse some notation, I was reading "$c->SUPER::get" as more like "($c->SUPER)::get" than like "$c->(SUPER::get)". That's not right; functions are the real things, and classes are the illusion.
At http://perldoc.perl.org/perlobj.html#Method-Invocation it says "...you may use the SUPER pseudo-class to tell Perl to start looking for the method in the packages named in the current class's @ISA list." When I've read that in the past, I guess I thought "current" referred to "that thing just to the left of the '->'" but it means "the thing after 'package' up above".
I feel like I understand better now.
| [reply] [d/l] [select] |
If crack is whack, then meth is death! | [reply] |