Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re (tilly) 2: Defensive Programmingby tilly (Archbishop) |
on Jan 15, 2002 at 03:50 UTC ( [id://138765]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Meditations
|
|