That can still be easily solved with a dispatch table.
sub _select_fields { my $self = shift; my %rev_types = ( both => sub { # some difficult logic }, total => sub { [qw/foo bar/] }, ); my $rev_type = $self->request->param('rev_type'); $rev_type = 'both' unless exists $rev_types{$rev_type}; return @{$rev_types{$rev_type}->()}; }
Though as noted above, the $rev_types should probably be moved outside of the sub.
If necessary, you can also write some code for generating a hash key based upon the difficult logic. This has the advantage of cleanly encapsulating the logic for each case rather than embedding it in the if/elsif/else constructs.
Cheers,
Ovid
New address of my CGI Course.
In reply to Re^2: A short, "iffy" rant
by Ovid
in thread A short, "iffy" rant
by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |