in reply to A short, "iffy" rant
The if construct can be soaked up in a trinary operator, too. Here's another way to organise things:
That way the selection logic and accessor are all bundled up in their own scope where nobody can harm them.{ my $rev_types = { both => [qw/rev theater_avg num_theaters/], total => [qw/rev num_theaters/], loc_avg => [qw/ theater_avg num_theaters/], all => [qw/rev theater_avg num_theaters day_multiple/], }; sub _rev_types { my $key = @_ ? shift : 'both'; exists $rev_type->{$key}? @{$rev_types->{$key}} : @{$rev_types->{'both'}}; } } sub _select_fields { my $self = shift; return _rev_types( $self->request->param('rev_type')); }
After Compline,
Zaxo
|
|---|