in reply to Choosing between multiple closures
Even though you said the issue is solved, I'm curious as to why dispatch tables didn't work, since that's another common approach?
my %DISPTBL = ( INCREMENT => sub { my ( $number, $incval ) = @_; return sub { ... } }, ); sub do_something { my $action = shift; return $DISPTBL{$action}(@_); } ...
You could even skip do_something completely and go right to the table...
|
|---|