Mainly for Reverend Phil, this is an Evil Hack (so I'm not sure the Reverend will appreciate it). If you have a bunch of packages, and you want to call a function from one of them without telling Perl where it is, here's a way to do it.
@SEARCH = qw( This::Package That::One Those ); AUTOLOAD { $AUTOLOAD =~ s/.*:://; # just the function name, ma'am for (@SEARCH) { my $f = join "::", $_, $AUTOLOAD; goto &$f if defined &$f; } # error handling here }

Replies are listed 'Best First'.
Re: Find that function!
by premchai21 (Curate) on Jan 18, 2002 at 00:47 UTC

    Slight cleanup: I think it is possible to do

    my $f = "${_}::$AUTOLOAD";

    instead of that join. Now I know it doesn't work exactly the same way, but why not use the built-in @ISA functionality for this instead? Is there some benefit that can be derived from searching only one level deep? Or something else I'm missing?