Re: [code-review] WebService::Validator::HTML::W3C

Richard Clamp <richardc-PThgL6HeIXdH4x6Dk/[email protected]> Fri, 14 Nov 2003 17:56:53 +0000
Newsgroups gmane.comp.lang.perl.code-review-ladder
Message-ID <[email protected]>
On Fri, Nov 14, 2003 at 05:01:20PM +0000, Struan Donald wrote:
> Hi,
> 
> Any thoughts/improvements/whatever on the attached?

Every time I see code like this:

 if (cond) {
    # if code
    return $thing;
 }
 else {
    # else code
 }

I get a ringing bell that says "hey, the programmer doesn't understand
what the flow of control is here", and I find that some other shoe
drops some time soon after.

A more pleasing form (for me) is this:

 if (cond) {
    # if code
    return $thing;
 }
 # else code

As at least expressed that way it seems that you know what return does
for you.

-- 
Richard Clamp <richardc-PThgL6HeIXdH4x6Dk/[email protected]>