Do you know where your variables are? | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Excellent! ++! Now, that explains what's going on. It's a little worrying that these examples are not in the Error documentation. A few thoughts:
The first example, to me, is an example of how not to use try-catch. To me, you shouldn't be doing a return 0 within a catch. You should be rethrowing some error after doing what you needed to do. The only return statement should be as a result of success. Regardless of memory leaks, that's just poor practice. The second method ... the closure concern is a bit harsher for me. Matts does provide a solution for it, but I don't like it as it removes the major benefit imho, which is the syntactic sugar. I'll have to think about it and see whether it has a good workaround. ------ Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement. Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified. In reply to Re4: Learning how to use the Error module by example
by dragonchild
|
|