On Thu, 20 Oct 2005 07:40:25 -0700 (GMT-07:00), Mark A. Fuller wrote:
Hi Mark
> One reason I have a nasty if/else block in my setup method is that
Nasty all right. But that's from having a non-Perl background I assume. We all
go thru this before learning how to do it the Perl way :-().
[snip nasty anti-Perl 'if']
Perl solution: Use hashes.
my($subarea) = $self -> {q} -> param('subarea') || '';
my($option) = $self -> {q} -> param('change_psw') ||
$self -> {q} -> param('change_acc') ||
$self -> {q} -> param('send_verify') || '';
my(%mode) =
(
account =>
{
change_psw => 21,
change_acc => 22,
send_verify => 23,
'' => 20,
},
etc =>
{
},
);
my($mode) = $subarea ? $mode{$subarea}{$option} : 19;
--
Cheers
Ron Savage, suppressed on 21/10/2005
http://savage.net.au/index.html
Let the record show: Microsoft is not an Australian company
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.