in reply to abstraction -- level up!
Well one step to simplifiy that would be to use selectall_array($sql, {Slice => {}}) and then one of your subs becomes:
Something along those lines at least. Then you see your just passing a SQL statment and you have a condition for selection. I'm not sure if if can be reduced any but this is a nice reduction so far.sub _getBuilderList { my $self = shift; my $selection = shift; my @cities = $self->param('DBH')->selectall_array("SELECT id, +buildername FROM builder ORDER BY buildername", {Slice => {}} ); @cities = grep { $_->{SELECTED}++ if $_->{id} == $selection; $ +_ } @cities; return \@cities; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: abstraction -- level up!
by geektron (Curate) on Jun 16, 2004 at 18:13 UTC | |
by jeffa (Bishop) on Jun 16, 2004 at 18:58 UTC | |
by geektron (Curate) on Jun 16, 2004 at 23:07 UTC | |
by jeffa (Bishop) on Jun 17, 2004 at 14:42 UTC | |
by geektron (Curate) on Jun 17, 2004 at 19:57 UTC | |
|