X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FPeek.pm;h=adb5667cba75f927c8905ab2e3538ec8d91aa0fc;hp=f9bb3ed8e44ea85fa7ba406febfb3bac44142a39;hb=3a40071593734bf02e987a076b6408095ecfad41;hpb=3d22167c1a074925fcfc1d69b31b4d27b358195e diff --git a/lib/Devel/REPL/Plugin/Peek.pm b/lib/Devel/REPL/Plugin/Peek.pm index f9bb3ed..adb5667 100644 --- a/lib/Devel/REPL/Plugin/Peek.pm +++ b/lib/Devel/REPL/Plugin/Peek.pm @@ -7,16 +7,24 @@ use Devel::Peek qw(Dump); use namespace::clean -except => [ 'meta' ]; -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__