BEGIN { my %cache; sub do_it { my $func = shift; ($cache{$func} ||= do { local @ISA; __PACKAGE__->can("do_$fun") }) ->(@_); } } ... do_it("function", $arg1, $arg2, @more_args);