http://www.perlmonks.org?node_id=1038687


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