Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: ->SUPER::hi relies on __PACKAGE__ ? (monkeypatching) Can't locate object method "hi" via package "main::SUPER"

by tobyink (Abbot)
on Jun 13, 2013 at 06:54 UTC ( #1038687=note: print w/ replies, xml ) Need Help??


in reply to ->SUPER::hi relies on __PACKAGE__ ? (monkeypatching) Can't locate object method "hi" via package "main::SUPER"

Yes, SUPER:: relies on __PACKAGE__. But you can always provide an explicit package name in your super call...

@Bar::ISA = qw(Foo); sub Bar::xxx { my $self = shift; warn "Bar::xxx called"; return $self->Foo::xxx(@_); # instead of SUPER::xxx }
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name


Comment on Re: ->SUPER::hi relies on __PACKAGE__ ? (monkeypatching) Can't locate object method "hi" via package "main::SUPER"
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2015-07-03 00:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (47 votes), past polls