summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Eval/Closure.pm20
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;