From: Jesse Luehrs Date: Wed, 20 Oct 2010 20:13:40 +0000 (-0500) Subject: die if the source doesn't return a subroutine reference X-Git-Tag: 0.01~22 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=26eb0e7a6a9fd292fe305e389089e4611e223e0d;p=gitmo%2FEval-Closure.git die if the source doesn't return a subroutine reference --- diff --git a/lib/Eval/Closure.pm b/lib/Eval/Closure.pm index 1ce0327..e45cb98 100644 --- a/lib/Eval/Closure.pm +++ b/lib/Eval/Closure.pm @@ -59,7 +59,13 @@ sub _clean_eval_closure { } my $code = eval _make_source(@_); - ($code, $@); + + if (!ref($code) || ref($code) ne 'CODE') { + undef $code; + $@ = "The 'source' parameter must return a subroutine reference"; + } + + return ($code, $@); } sub _make_source {