From 0fb2ea464c6eb6c52831d44ef541a0d4d5c95a92 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 2 Aug 2011 00:36:58 -0500 Subject: i always forget that B exists --- lib/Eval/Closure.pm | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'lib') diff --git a/lib/Eval/Closure.pm b/lib/Eval/Closure.pm index 45c36b6..23cf250 100644 --- a/lib/Eval/Closure.pm +++ b/lib/Eval/Closure.pm @@ -200,21 +200,23 @@ sub _clean_eval_closure { my $source = _make_compiler_source(@_); unless (exists $compiler_cache{$source}) { - local $@; - local $SIG{__DIE__}; - my $compiler = do { - package # hide from PAUSE - Eval::Closure::Sandbox; - eval $source; - }; - my $e = $@; - $compiler_cache{$source} = [ $compiler, $e ]; + $compiler_cache{$source} = _clean_eval($source); } return @{ $compiler_cache{$source} }; } } +sub _clean_eval { + package # hide from PAUSE + Eval::Closure::Sandbox; + local $@; + local $SIG{__DIE__}; + my $compiler = eval $_[0]; + my $e = $@; + return [ $compiler, $e ]; +} + sub _make_compiler_source { my ($source, @capture_keys) = @_; my $i = 0; -- cgit v1.2.3-54-g00ecf