in reply to Some suggestions on coding style - a chance to critique
sub function { # code in here }
This keeps the brackets lined up vertically, and helps me keep track of deeply nested loops. Of course, this is certainly preference, and doesn't really have much to do wrt the code.
@$required = split /,/, $$formdata{'required'} unless ($$formdata{ +'required'} eq ""); $$redirect = $$formdata{'redirect'} unless ($$formdata{'required'} + eq ""); . . .
I hate stuff like this. Assigning variables to hash values, IMHO, should only be done if you have some really complex data structures, and even then, I believe you should use some sort of interpolation, lest you continue to de-ref every time you access something.
$method = "<font face=verdana size=1>An error with the script's in +stallation has occured. Please contact the webmaster with the error messages listed be +low!" if $method == 0; $method = "<font face=verdana size=1>An error occured with your su +bmission. Please check the errors and make any necessary modficiations!</font>" + if $method == 1;
Use standard if-then/ternary syntax here. Make perl figure out which case you're on before assigning the $method values. AFAIK, in your code, it assigns the value, then will pitch it if the conditional isn't met. Don't waste the cycles.
HTH, and again, much of this may be just preference.
ÅßÅ×ÅßÅ
"It is a very mixed blessing to be brought back from the dead." -- Kurt Vonnegut |
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Some suggestions on coding style - a chance to critique
by chromatic (Archbishop) on Jun 26, 2002 at 20:03 UTC | |
Re: Re: Some suggestions on coding style - a chance to critique
by emilford (Friar) on Jun 26, 2002 at 15:35 UTC | |
by Aristotle (Chancellor) on Jun 26, 2002 at 15:51 UTC | |
by myocom (Deacon) on Jul 01, 2002 at 19:02 UTC |