in reply to Re: Call to subs in a Dispatch Table
in thread Call to subs in a Dispatch Table
... this creates a circular reference, which probably won't be a problem ...
It also creates a circular, i.e., infinite, execution loop, which probably will be a problem.
c:\@Work\Perl\monks>perl -wMstrict -le "sub names { print qq{@_}; } ;; my %dispatch; %dispatch = ( circular => sub { names('fu', 'bar'); sleep 1; $dispatch{circular}->(); }, straight => sub { names('a', 'ok'); }, ); ;; $dispatch{straight}->(); $dispatch{circular}->(); " a ok fu bar fu bar fu bar fu bar Terminating on signal SIGINT(2)
Give a man a fish: <%-(-(-(-<
|
|---|