in reply to Re (tilly) 1: Strict, strings and subroutines
in thread Strict, strings and subroutines
I thought about that one too, but it also follows @ISA. You can fix that with this:
Much smoke. Many mirrors. In fact, I'd cache the result too:do { local @ISA; __PACKAGE__->can("do_$type") }->();
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);
In Section
Seekers of Perl Wisdom