I know I'm not grasping all of your requirements here ... so maybe this will help you along your way.
This prints out "Subfactory".package Drone; sub new { return bless {}, shift; } 1; package Factory; no strict 'refs'; sub fixup { #*Drone::bar = sub { return __PACKAGE__ }; my $class = shift || __PACKAGE__; *Drone::bar = sub { return $class }; } 1; package Subfactory; use base qw( Factory ); 1; package main; Subfactory->fixup; my $foo = Drone->new; print $foo->bar . "\n";
In reply to Re^3: __PACKAGE__ in anonysub
by Tanktalus
in thread __PACKAGE__ in anonysub
by thpfft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |