From a3b93402cf7c115ee6af614bf1bc214280266f03 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 19 Feb 2010 22:49:12 +0000 Subject: [PATCH] Compile errors in input shouldn't call outer DIE block. --- perl/lib/Net/REPL/Base.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/perl/lib/Net/REPL/Base.pm b/perl/lib/Net/REPL/Base.pm index 3579735..9341db3 100644 --- a/perl/lib/Net/REPL/Base.pm +++ b/perl/lib/Net/REPL/Base.pm @@ -99,7 +99,11 @@ Eval the Perl $code and return the Dumper'd or serialized result. sub formatted_eval { my ($self, $input) = @_; - my @output = eval('sub { ' . $input . '}->();'); + my @output; + do { + local $SIG{'__DIE__'} = 'DEFAULT'; + @output = eval('sub { ' . $input . '}->();'); + }; # TODO: should this also pass through warnings? if ($@) { return $@; -- 2.11.4.GIT