print a warning when Completion is loaded but the Term::ReadLine object doesn't suppo...
[p5sagit/Devel-REPL.git] / lib / Devel / REPL.pm
index 07f3828..a46fbbe 100644 (file)
@@ -3,9 +3,9 @@ package Devel::REPL;
 use Term::ReadLine;
 use Moose;
 use namespace::clean -except => [ 'meta' ];
-use 5.8.1; # might work with earlier perls but probably not
+use 5.008001; # backwards compat, doesn't warn like 5.8.1
 
-our $VERSION = '1.000000';
+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
@@ -101,10 +108,28 @@ Devel::REPL - a modern perl interactive shell
 
 Alternatively, use the 're.pl' script installed with the distribution
 
+  system$ re.pl
+
 =head1 AUTHOR
 
 Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co.uk/>)
 
+=head1 CONTRIBUTORS
+
+=over 4
+
+=item Stevan Little - stevan (at) iinteractive.com
+
+=item Alexis Sukrieh - sukria+perl (at) sukria.net
+
+=item epitaph
+
+=item mgrimes - mgrimes (at) cpan dot org
+
+=item Shawn M Moore - sartak (at) gmail.com
+
+=back
+
 =head1 LICENSE
 
 This library is free software under the same terms as perl itself