in reply to •Re^2: goto superclass method
in thread goto superclass method
SUPER:: is always relative to __PACKAGE__, and when you start saying sub Foo::bar, the __PACKAGE__ doesn't change to Foo, so you have a problem with SUPER.
That's wrong.
#!/usr/bin/perl use strict; use warnings; package Foo; sub bar { } package Baz; our @ISA = qw( Foo ); sub bar { my $self = shift; print $self->SUPER::can( "bar" ), "\n"; print $self->can( "SUPER::bar" ), "\n"; }; package main; print UNIVERSAL::can( Baz => "bar" ), "\n"; Baz->bar; __END__ CODE(0x815a230) CODE(0x815a230) CODE(0x813bc4c)
Interestingly enough, I thought I had tried the $self->can( "SUPER::foo" ) combination, but apparently I didn't. Huh.
Makeshifts last the longest.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re^4: goto superclass method
by merlyn (Sage) on Dec 22, 2004 at 23:19 UTC | |
by Aristotle (Chancellor) on Dec 22, 2004 at 23:48 UTC | |
by merlyn (Sage) on Dec 22, 2004 at 23:53 UTC | |
by Aristotle (Chancellor) on Dec 23, 2004 at 00:14 UTC | |
by merlyn (Sage) on Dec 23, 2004 at 00:22 UTC | |
|