in reply to Re: Re (tilly) 1: Strict, strings and subroutines
in thread Strict, strings and subroutines
Great.
A pity you don't cache the possibility that it doesn't exist:
JeroenBEGIN { my %cache; sub do_it { my $func = shift; $cache{$func} = do { local @ISA; __PACKAGE__->can("do_$fun") } unless exist $cache{$func}; $cache{$func}->(@_); } }
Update: merlyn is right. Fixed that.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re:{3} Strict, strings and subroutines
by merlyn (Sage) on Oct 10, 2001 at 19:45 UTC |
In Section
Seekers of Perl Wisdom