in reply to How to get the name of an aliased function
Maybe you could play with AUTOLOAD() instead of aliases and caller. AUTOLOAD is made to do this sort of thing.
use strict; use warnings; sub AUTOLOAD { my $called = ( split /::/, $main::AUTOLOAD )[-1]; my %recognized; @recognized{'this', 'that', 'those'} = (); exists $recognized{$called} or die "I don't know how to $called.\n"; print "I was called as $called\n"; } this(); that(); those(); woops();
Dave
|
|---|