well has asked for the wisdom of the Perl Monks concerning the following question:
We all know solution for this from Perl Cookbook with a hashtable.$actions = $CGI->param ('action'); $to_do = new INVOICES(); if ($actions eq 'delayedinv') { $to_do->delayedinv() } elsif ($actions eq 'del_inv') { $to_do->del_inv() } elsif ($actions eq 'payed' ) { $to_do->payed () } elsif ($actions eq 'stats' ) { $to_do->stats () } ... skip ... else { $to_do->defscreen()}
also we can implement with regexp a filter to prevent access to private methods.$actions = $CGI->param ('action'); $to_do = new INVOICES(); eval {$to_do->$actions} || defscreen();
Edit kudra, 2002-09-06 Replaced br tags with code tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: input switch
by broquaint (Abbot) on Sep 06, 2002 at 12:28 UTC | |
by Anonymous Monk on Sep 10, 2002 at 12:59 UTC | |
|
Re: input switch
by LTjake (Prior) on Sep 06, 2002 at 12:46 UTC | |
|
Re: input switch
by Aristotle (Chancellor) on Sep 06, 2002 at 14:22 UTC | |
|
Re: input switch
by RatArsed (Monk) on Sep 06, 2002 at 12:04 UTC | |
by Aristotle (Chancellor) on Sep 06, 2002 at 14:11 UTC | |
by RatArsed (Monk) on Sep 09, 2002 at 08:16 UTC | |
by Aristotle (Chancellor) on Sep 09, 2002 at 08:54 UTC | |
by RatArsed (Monk) on Sep 09, 2002 at 12:22 UTC | |
| |
|
Re: input switch
by larryk (Friar) on Sep 06, 2002 at 14:30 UTC | |
by Aristotle (Chancellor) on Sep 07, 2002 at 00:25 UTC |