X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FColors.pm;h=17592b84f56d973135e9ad29ac572ed8f825c63b;hp=898437db9a9f106c2c224e312882a05d2dc897a6;hb=e22aa835df762f888ec7ff9efb2a599ebe17538e;hpb=97d28d6b74a5aa91b2af19a28c438caa193bfac0 diff --git a/lib/Devel/REPL/Plugin/Colors.pm b/lib/Devel/REPL/Plugin/Colors.pm index 898437d..17592b8 100644 --- a/lib/Devel/REPL/Plugin/Colors.pm +++ b/lib/Devel/REPL/Plugin/Colors.pm @@ -14,7 +14,7 @@ has error_color => ( default => 'bold red', ); -around error_return => sub { +around format_error => sub { my $orig = shift; my $self = shift; return color($self->error_color) @@ -23,12 +23,14 @@ around error_return => sub { }; # we can't just munge @_ because that screws up DDS -around print => sub { +around format_result => sub { my $orig = shift; my $self = shift; - print {$self->out_fh} color($self->normal_color); - $orig->($self, @_); - print {$self->out_fh} color('reset'); + return join "", ( + color($self->normal_color), + $orig->($self, @_), + color('reset'), + ); }; # make arbitrary warns colored -- somewhat difficult because warn doesn't