Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Why can't I call SUPER from user code?

by hv (Prior)
on Mar 31, 2006 at 00:06 UTC ( [id://540328]=note: print w/replies, xml ) Need Help??


in reply to Why can't I call SUPER from user code?

Because there isn't just one SUPER: perl needs to know what class you want the superclass of. If you tell it, perl will be happy:

$foo1->bang(); $foo2->bang(); { package BAZ; $foo3->SUPER::bang(); }

This is needed because you may have another class:

package QUUX; use base qw/ BAR /; sub bang { shift->SUPER::bang }
.. which means that BAR::bang() may be called by objects that don't have ref($self) eq 'BAR'.

Hugo

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found