I don't see a need for a dispatch table here. I thought for a while that a comma operator might be a usefull thing, but in the end I suspect that the following is fairly tidy and efficient:
my $msg = "Status has changed" if $bbstatus ne $last_bbstatus; $msg = "Last send too old" if ! length $msg and ($now - $last_send_time) > $min_frequency; $msg = "Forced send requested" if ! length $msg and defined($OPTS::opts{f}); $send_flag = length $msg; $msg ||= "No changes";
BTW, if you are interested in seeing an almost dispatch table in use take a look at Ook interpreter. %xlate could be used as is as a dispatch table, but instead it is used to 'compile' the source to generate 'machine code' in @code
In reply to Re: Is a Dispatch Table appropriate here?
by GrandFather
in thread Is a Dispatch Table appropriate here?
by McDarren
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |