Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re (tilly) 2: Defensive Programming

by tilly (Archbishop)
on Jan 15, 2002 at 03:50 UTC ( [id://138765]=note: print w/replies, xml ) Need Help??


in reply to Re: Defensive Programming
in thread Defensive Programming

You know that that return shouldn't happen, right?

So if someone changes your function so that it can avoid any of the meaningful returns, something is probably wrong, right?

Wouldn't you like to know about it in that situation? For that reason I sometimes do something like the above, except instead of a return I use Carp's confess and confess that I don't know how I got there. This is particularly useful I find after "endless loops" that I return out of. Should I fall out of the loop (something which I intend to be impossible), that is a programming logic error and I darned well want to catch the mistake sooner rather than later.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://138765]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-26 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found