Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
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 avoiding work at the Monastery: (9)
As of 2014-12-27 17:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (177 votes), past polls