in reply to package sub and code reference

I probably shouldn't do this, but here goes the deep magic:
my %codeRefs = map { "Package"->can($_) || sub { die "can't find $_" } } qw(SubRoutine1 SubRoutine2 SubRoutine3);
and now $codeRefs{SubRoutine1}->(@args) will invoke Package::SubRoutine1(@args), or an inherited version if needed, or die if nothing else.

Yeah, scary deep magic. And it even works under "use strict". Augh!

-- Randal L. Schwartz, Perl hacker

Replies are listed 'Best First'.
Re (tilly) 2: package sub and code reference
by tilly (Archbishop) on Sep 28, 2001 at 04:48 UTC
    If you are trying to scare people, you should mention that by throwing things like OtherPackage'FunctionName in the list you can have it search for functions starting from an arbitrary package.