From: oliver Date: Sat, 7 Feb 2009 17:21:13 +0000 (+0000) Subject: resolve rt.cpan#42904 Nopaste plugin handle undef error messages X-Git-Tag: v1.003015~69 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a478012dca1a93094781d2df758c4f7dc8d0a87e;p=p5sagit%2FDevel-REPL.git resolve rt.cpan#42904 Nopaste plugin handle undef error messages git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@5424 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Changes b/Changes index ed33426..069f24a 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ 1.3.3 - make Nopaste attribute lazy - make ReadLineHistory history file location portable + - resolve rt.cpan#42904 Nopaste plugin handle undef error messages 1.3.2 - make plugins be M::I features so dependencies are optional - resolve rt.cpan#42506 readdir might fail diff --git a/lib/Devel/REPL/Plugin/Nopaste.pm b/lib/Devel/REPL/Plugin/Nopaste.pm index 40fa76d..283fdfb 100644 --- a/lib/Devel/REPL/Plugin/Nopaste.pm +++ b/lib/Devel/REPL/Plugin/Nopaste.pm @@ -3,6 +3,7 @@ package Devel::REPL::Plugin::Nopaste; use Devel::REPL::Plugin; use MooseX::AttributeHelpers; use namespace::clean -except => [ 'meta' ]; +use Scalar::Util qw(blessed); sub BEFORE_PLUGIN { my $self = shift; @@ -36,8 +37,17 @@ around eval => sub { my $line = shift; my @ret = $orig->($self, $line, @_); - - $self->add_to_session(join("\n", @ret) . "\n\n"); + my @ret_as_str = map { + if (!defined($_)) { + ''; + } elsif (blessed($_) && $_->can('stringify')) { + $_->stringify(); + } else { + $_; + } + } @ret; + + $self->add_to_session(join("\n", @ret_as_str) . "\n\n"); return @ret; };