diff options
author | Jesse Luehrs <doy@tozt.net> | 2011-08-02 00:36:58 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2011-08-02 01:05:45 -0500 |
commit | 0fb2ea464c6eb6c52831d44ef541a0d4d5c95a92 (patch) | |
tree | 41685e2b53718ddef4b6b1e21c6d61d147e2c32a /lib | |
parent | a0e934a667e05d3a8b5556e257938472cd9d6243 (diff) | |
download | eval-closure-0fb2ea464c6eb6c52831d44ef541a0d4d5c95a92.tar.gz eval-closure-0fb2ea464c6eb6c52831d44ef541a0d4d5c95a92.zip |
i always forget that B exists
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Eval/Closure.pm | 20 |
1 files changed, 11 insertions, 9 deletions
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; |