This does precisely what mine does. Did you mean "exists" there instead of "defined"?BEGIN { my %cache; sub do_it { my $func = shift; $cache{$func} = do { local @ISA; __PACKAGE__->can("do_$fun") } unless defined $cache{$func}; $cache{$func}->(@_); } }
-- Randal L. Schwartz, Perl hacker
In reply to Re: Re:{3} Strict, strings and subroutines
by merlyn
in thread Strict, strings and subroutines
by hatter
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |