From: nothingmuch Date: Mon, 5 May 2008 18:41:35 +0000 (+0000) Subject: update B::Concise plugin for error handling X-Git-Tag: v1.003015~124 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3d22167c1a074925fcfc1d69b31b4d27b358195e;p=p5sagit%2FDevel-REPL.git update B::Concise plugin for error handling git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@4328 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/lib/Devel/REPL/Plugin/B/Concise.pm b/lib/Devel/REPL/Plugin/B/Concise.pm index b065b60..b262164 100644 --- a/lib/Devel/REPL/Plugin/B/Concise.pm +++ b/lib/Devel/REPL/Plugin/B/Concise.pm @@ -30,13 +30,17 @@ sub expr_command_concise { my $sub = $self->compile($code, no_mangling => 1); - open my $fh, ">", \my $out; - { - local *STDOUT = $fh; - B::Concise::compile((split /\s+/, $opts), $sub)->(); + if ( $self->is_error($sub) ) { + return $self->format($sub); + } else { + open my $fh, ">", \my $out; + { + local *STDOUT = $fh; + B::Concise::compile((split /\s+/, $opts), $sub)->(); + } + + return $out; } - - return $out; } __PACKAGE__ diff --git a/lib/Devel/REPL/Plugin/Peek.pm b/lib/Devel/REPL/Plugin/Peek.pm index e6f4893..f9bb3ed 100644 --- a/lib/Devel/REPL/Plugin/Peek.pm +++ b/lib/Devel/REPL/Plugin/Peek.pm @@ -12,10 +12,6 @@ with qw(Devel::REPL::Plugin::Turtles); sub expr_command_peek { my ( $self, $eval, $code ) = @_; - if ( my $cont = $self->can("continue_reading_if_necessary") ) { - $code = $self->$cont($code); - } - # can't override output properly # FIXME do some dup wizardry Dump( $self->eval($code) );