X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FPeek.pm;h=c8a871f70228992c0d81eaeadc416ad12a916565;hb=9b7bfb6ac233dca407f12db47aa8dda7c9c1d338;hp=f9bb3ed8e44ea85fa7ba406febfb3bac44142a39;hpb=3d22167c1a074925fcfc1d69b31b4d27b358195e;p=p5sagit%2FDevel-REPL.git diff --git a/lib/Devel/REPL/Plugin/Peek.pm b/lib/Devel/REPL/Plugin/Peek.pm index f9bb3ed..c8a871f 100644 --- a/lib/Devel/REPL/Plugin/Peek.pm +++ b/lib/Devel/REPL/Plugin/Peek.pm @@ -5,18 +5,26 @@ use Devel::REPL::Plugin; use Devel::Peek qw(Dump); -use namespace::clean -except => [ 'meta' ]; +use namespace::autoclean; -with qw(Devel::REPL::Plugin::Turtles); +sub BEFORE_PLUGIN { + my $self = shift; + $self->load_plugin('Turtles'); +} sub expr_command_peek { my ( $self, $eval, $code ) = @_; - # can't override output properly - # FIXME do some dup wizardry - Dump( $self->eval($code) ); + my @res = $self->eval($code); - return ""; # this is a hack to print nothing after Dump has already printed. PLZ TO FIX KTHX! + if ( $self->is_error(@res) ) { + return $self->format(@res); + } else { + # can't override output properly + # FIXME do some dup wizardry + Dump(@res); + return ""; # this is a hack to print nothing after Dump has already printed. PLZ TO FIX KTHX! + } } __PACKAGE__