make sure $@ is localized for evals
as perl "Modern Perl"
This commit is contained in:
parent
e9eacc69d8
commit
6c886e2864
@ -47,10 +47,11 @@ snippet xunless
|
||||
${1:expression} unless ${2:condition};${3}
|
||||
# Try/Except
|
||||
snippet eval
|
||||
local $@;
|
||||
eval {
|
||||
${1:# do something risky...}
|
||||
};
|
||||
if ($@) {
|
||||
if (my $e = $@) {
|
||||
${2:# handle failure...}
|
||||
}
|
||||
# While Loop
|
||||
|
Loading…
Reference in New Issue
Block a user