For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2007 > really bad use of postfix









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author really bad use of postfix
Ken Foskey

2007-04-28, 9:59 pm


Just like to show how NOT to use postfix. I have had a frustrating day
tackling this type of unreadable code.

>
> exec_rqst('stga2k_vps.pl',$FileNameIn) if ($a2kqual[4] eq
> "VPS");
> exec_rqst('stga2kif.sh',$FileNameIn) if ($a2kqual[4] ne
> "VPS");
>
>
> if ($a2kqual[4] eq "VPS") {
> exec_rqst('stga2k_vps.pl',$FileNameIn);
> }
> else {
> exec_rqst('stga2kif.sh',$FileNameIn);
> }
>


--
Ken Foskey
FOSS developer

John W. Krahn

2007-04-28, 9:59 pm

Ken Foskey wrote:[color=darkred]
> Just like to show how NOT to use postfix. I have had a frustrating day
> tackling this type of unreadable code.
>

How about this?

exec_rqst(
$a2kqual[ 4 ] eq 'VPS' ? 'stga2k_vps.pl' : 'stga2kif.sh',
$FileNameIn
);



John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
Dr.Ruud

2007-04-29, 6:58 pm

Ken Foskey schreef:
[color=darkred]
> Just like to show how NOT to use postfix. I have had a frustrating
> day tackling this type of unreadable code.
>

It could be generated code, or maybe the coder anticipated
side-effects, like @a2kqual getting adjusted inside exec_rqst().

--
Affijn, Ruud

"Gewoon is een tijger."
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com