From: Jesse Luehrs Date: Wed, 20 Oct 2010 20:19:31 +0000 (-0500) Subject: capture $@ immediately X-Git-Tag: 0.01~21 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=18b5b42a6d73121cf9ea8092d943ca4f5d3cc545;p=gitmo%2FEval-Closure.git capture $@ immediately --- diff --git a/lib/Eval/Closure.pm b/lib/Eval/Closure.pm index e45cb98..0037337 100644 --- a/lib/Eval/Closure.pm +++ b/lib/Eval/Closure.pm @@ -59,13 +59,14 @@ sub _clean_eval_closure { } my $code = eval _make_source(@_); + my $e = $@; if (!ref($code) || ref($code) ne 'CODE') { undef $code; - $@ = "The 'source' parameter must return a subroutine reference"; + $e = "The 'source' parameter must return a subroutine reference"; } - return ($code, $@); + return ($code, $e); } sub _make_source {