in reply to Re: Best practices for handling exceptions in die/eval style
in thread Best practices for handling exceptions in die/eval style
I used similar tactics:
eval { # here we try do_smth() } or { # here we catch ... }
But what is about $@ clobbering? I read in MVP book about it and it seems legit that we can clobber global variable. Now I find their code right:
# Try clause my ($error1, $error2); { local $@; unless (eval { ...; return 1 }) { $error1 = 1; $error2 = $@; } } # Catch clause if ($error1) { # handle exception }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Best practices for handling exceptions in die/eval style
by stevieb (Canon) on Aug 29, 2018 at 22:10 UTC | |
by krautcat (Acolyte) on Aug 29, 2018 at 22:22 UTC | |
by stevieb (Canon) on Aug 29, 2018 at 22:27 UTC | |
by krautcat (Acolyte) on Sep 05, 2018 at 22:36 UTC | |
by Anonymous Monk on Sep 06, 2018 at 00:46 UTC |