Thank you! That won't work in my real situation, because I won't be calling a class method like that, but you made me realise that instead of __PACKAGE__, I just need to call ref $self, which will inherit properly. D'oh:
my $self = shift; my $factory_class=ref $self; *Foo::bar = sub { return $factory_class->instance; };
I definitely am creating a closure now, but I don't think it will matter: it's only a simple scalar that gets unnaturally prolonged.
Thanks.
In reply to Re^4: __PACKAGE__ in anonysub
by thpfft
in thread __PACKAGE__ in anonysub
by thpfft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |