Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: SUPER lost in overloaded method

by hv (Prior)
on Feb 10, 2006 at 00:38 UTC ( [id://529251]=note: print w/replies, xml ) Need Help??


in reply to SUPER lost in overloaded method

The SUPER:: of a method is determined based on the package in which the method was compiled, not on the package in which it is called, nor the package in which it was found.

You can achieve the effect you want by compiling it in the right package:

{ package foo::bar; *foo = sub { my $self = shift; $self->SUPER::foo; }; }

There has been a fair bit of discussion over the years on the perl development lists about whether this behaviour is wrongly defined, but it's unlikely to be changed in any version of perl5.

Hugo

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://529251]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-26 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found