OutputCache: If sub _ is already defined, then warn about it (once) and refuse to...
[p5sagit/Devel-REPL.git] / lib / Devel / REPL.pm
index 4337fa1..6b1f11d 100644 (file)
@@ -5,7 +5,7 @@ use Moose;
 use namespace::clean -except => [ 'meta' ];
 use 5.8.1; # might work with earlier perls but probably not
 
-our $VERSION = '1.001000'; # 1.1.0
+our $VERSION = '1.002001'; # 1.2.1
 
 with 'MooseX::Object::Pluggable';
 
@@ -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