From: Jesse Luehrs Date: Wed, 20 Oct 2010 21:06:08 +0000 (-0500) Subject: if $code is undef, we have an actual error; don't overwrite that X-Git-Tag: 0.01~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=b86710e953dc6a4403be3f92ae7c1908f4584376;p=gitmo%2FEval-Closure.git if $code is undef, we have an actual error; don't overwrite that --- diff --git a/lib/Eval/Closure.pm b/lib/Eval/Closure.pm index fbd3e2c..719701d 100644 --- a/lib/Eval/Closure.pm +++ b/lib/Eval/Closure.pm @@ -77,7 +77,7 @@ sub _clean_eval_closure { my $code = eval _make_source(@_); my $e = $@; - if (!ref($code) || ref($code) ne 'CODE') { + if (defined($code) && (!ref($code) || ref($code) ne 'CODE')) { $e = "The 'source' parameter must return a subroutine reference, " . "not $code"; undef $code;