[sf-perl] Can't figure this one out
Matisse Enzer
matisse at matisse.net
Thu Mar 13 10:52:55 PDT 2008
On Mar 5, 2008, at 3:46 PM, nheller at silcon.com wrote:
>
> if ($action =~ /start/i) { <-------- line 511, the offender
> &MainPage($q, \%p);
> }
> elsif ($action =~ /new/i ||
> $action =~ /del/i ||
> $action =~ /edt/i ||
> $action =~ /save/i )
> {
>
>
I wonder if you should also change this to:
my $main_sub = sub { MainPage( $q,\%p };
my $other_sub = sub { do_stuff( @_ ) };
my %dispatch_to = (
start => $main_sub,
new => $other_sub,
del => $other_sub,
edit => $other_sub,
save => $other_sub,
);
my $lower_case_action = lc $action;
my $dispatch_sub = $dispatch_to{ $lower_case_action };
$dispatch_sub->( @other_args_can_go_here );
-------------------------------------------------------
Matisse Enzer <matisse at matisse.net>
http://www.matisse.net/ - http://www.eigenstate.net/
More information about the SanFrancisco-pm
mailing list