Clobbering is why, years ago, I changed to the tactic I use now. The $@ can be clobbered in some certain circumstances. The return 1; is the equivalent of just having 1;... the block will return the last expression evaluated (1) without the explicit return().
If you get undef, you know that eval failed (ie. die()d), regardless of/if $@ was populated or not. Localizing $@ is definitely a wise idea if that's the route one wants to take, but it's too much code for me. Keep subs and tests tight and small, and you should be able to know what the problem is specifically, without the need of $@'s contents (that definitely isn't a hard rule by any stretch, so take with a grain of salt).
In reply to Re^3: Best practices for handling exceptions in die/eval style
by stevieb
in thread Best practices for handling exceptions in die/eval style
by krautcat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |