From: matthewt Date: Thu, 8 Nov 2007 22:11:19 +0000 (+0000) Subject: fix REPL.pm to obsolete NewlineHack, commit changes file (oops) X-Git-Tag: v1.003015~141 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a66625d6c24801141f527e1c0bea3f8f7ea20239;p=p5sagit%2FDevel-REPL.git fix REPL.pm to obsolete NewlineHack, commit changes file (oops) git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@3865 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/Changes b/Changes new file mode 100644 index 0000000..1029e12 --- /dev/null +++ b/Changes @@ -0,0 +1,9 @@ + - deprecate NewlineHack plugin, cause fixed in REPL.pm +1.1.0 + - profile system + - fix up dependencies + - DDS plugin + - Commands plugin + - Plugin metaclass +1.0.0 + - Initial release diff --git a/lib/Devel/REPL.pm b/lib/Devel/REPL.pm index 4337fa1..b07769c 100644 --- a/lib/Devel/REPL.pm +++ b/lib/Devel/REPL.pm @@ -36,7 +36,13 @@ sub run_once { my $line = $self->read; return unless defined($line); # undefined value == EOF my @ret = $self->eval($line); - $self->print(@ret); + eval { + $self->print(@ret); + }; + if ($@) { + my $error = $@; + eval { $self->print("Error printing! - $error\n"); }; + } return 1; } @@ -87,6 +93,7 @@ sub print { my $fh = $self->out_fh; no warnings 'uninitialized'; print $fh "@ret"; + print $fh "\n" if $self->term->ReadLine =~ /Gnu/; } =head1 NAME diff --git a/lib/Devel/REPL/Plugin/NewlineHack.pm b/lib/Devel/REPL/Plugin/NewlineHack.pm index 076b8ac..1945199 100644 --- a/lib/Devel/REPL/Plugin/NewlineHack.pm +++ b/lib/Devel/REPL/Plugin/NewlineHack.pm @@ -1,3 +1,5 @@ +# Original comment: +# # Adds a newline after print. Some readlines need it some don't. I guess # we should clarify whether this is a bug and if so whose bug at some point # but this'll do for now ;) @@ -7,12 +9,12 @@ package Devel::REPL::Plugin::NewlineHack; use Moose::Role; use namespace::clean -except => [ 'meta' ]; -after 'print' => sub { - # not fussed about args - my ($self) = @_; - my $fh = $self->out_fh; - print $fh "\n"; -}; +warn <