bump version for release
[p5sagit/Devel-REPL.git] / lib / Devel / REPL.pm
index 7c341de..2dc6035 100644 (file)
@@ -2,34 +2,42 @@ package Devel::REPL;
 
 use Term::ReadLine;
 use Moose;
-use namespace::clean -except => [ 'meta' ];
+use namespace::autoclean;
 use 5.008001; # backwards compat, doesn't warn like 5.8.1
 
-our $VERSION = '1.002001'; # 1.2.1
+our $VERSION = '1.003019';
 
 with 'MooseX::Object::Pluggable';
 
 use Devel::REPL::Error;
 
 has 'term' => (
-  is => 'rw', required => 1,
+  is => 'rw',
+  lazy => 1,
   default => sub { Term::ReadLine->new('Perl REPL') }
 );
 
 has 'prompt' => (
-  is => 'rw', required => 1,
+  is => 'rw',
   default => sub { '$ ' }
 );
 
 has 'out_fh' => (
-  is => 'rw', required => 1, lazy => 1,
+  is => 'rw',
+  lazy => 1,
   default => sub { shift->term->OUT || \*STDOUT; }
 );
 
+has 'exit_repl' => (
+  is => 'rw',
+  default => sub { 0 }
+);
+
 sub run {
   my ($self) = @_;
   while ($self->run_once_safely) {
-    # keep looping
+    # keep looping unless we want to exit REPL
+    last if $self->exit_repl;
   }
 }
 
@@ -51,11 +59,11 @@ sub run_once {
   my ($self) = @_;
 
   my $line = $self->read;
-  return unless defined($line); # undefined value == EOF
+  return unless defined($line);     # undefined value == EOF
 
   my @ret = $self->formatted_eval($line);
 
-  $self->print(@ret);
+  $self->print(@ret) unless $self->exit_repl;
 
   return 1;
 }
@@ -180,8 +188,8 @@ message will be returned. Here are a few examples:
  1
  $_ nosuchfunction
  Compile error: Bareword "nosuchfunction" not allowed while "strict subs" in use at (eval 130) line 5.
- $_ 
+
+ $_
 
 In the first example above you see the output of the command (C<Hello,
 world!>), if any, and then the return value of the statement (C<1>). Following
@@ -192,7 +200,7 @@ run inside a Block structure (to protect the REPL in case the code blows up),
 which means a single statement doesn't require the semicolon. You can add one
 if you like, though.
 
-If you followed the first example in the L</"SYNOPSIS"> above, you'l have the
+If you followed the first example in the L</"SYNOPSIS"> above, you'll have the
 History and LexEnv plugins loaded (and there are many more available).
 Although the shell might support "up-arrow" history, the History plugin adds
 "bang" history to that so you can re-execute chosen commands (with e.g.
@@ -208,16 +216,20 @@ exported functions from that module are available for immediate use:
          (Do you need to predeclare carp?)
  Compile error: syntax error at (eval 129) line 5, near "carp "I'm dieeeing!\n""
  BEGIN not safe after errors--compilation aborted at (eval 129) line 5.
- $_ use Carp 
+
+ $_ use Carp
+
  $_ carp "I'm dieeeing!\n"
  I'm dieeeing!
   at /usr/share/perl5/Lexical/Persistence.pm line 327
  1
- $_ 
+ $_
+
+To quit from the shell, hit C<Ctrl+D> or C<Ctrl+C>.
+
+  MSWin32 NOTE: control keys won't work if TERM=dumb
+  because readline functionality will be disabled.
 
-To quit from the shell, hit C<control+d> or C<control+c>.
 
 =head2 Run Control Files
 
@@ -277,6 +289,34 @@ L<Devel::REPL::Plugin::Commands>
 
 L<Devel::REPL::Plugin::MultiLine::PPI>
 
+=item *
+
+L<Devel::REPL::Plugin::Colors>
+
+=item *
+
+L<Devel::REPL::Plugin::Completion>
+
+=item *
+
+L<Devel::REPL::Plugin::CompletionDriver::INC>
+
+=item *
+
+L<Devel::REPL::Plugin::CompletionDriver::LexEnv>
+
+=item *
+
+L<Devel::REPL::Plugin::CompletionDriver::Keywords>
+
+=item *
+
+L<Devel::REPL::Plugin::CompletionDriver::Methods>
+
+=item *
+
+L<Devel::REPL::Plugin::ReadlineHistory>
+
 =back
 
 =head2 Plugins
@@ -289,7 +329,9 @@ output, or even add commands to the shell environment.
 
 A number of plugins ship with C<Devel::REPL>, and more are available on the
 CPAN. Some of the shipped plugins are loaded in the default profile, mentioned
-above.
+above.  These plugins can be loaded in your C<< $HOME/.re.pl/repl.rc >> like:
+
+  load_plugin qw( CompletionDriver::Global DumpHistory );
 
 Writing your own plugins is not difficult, and is discussed in the
 L<Devel::REPL::Plugin> manual page, along with links to the manual pages of
@@ -322,19 +364,19 @@ the following:
 
 =item *
 
-L<Moose> >= 0.38
+L<Moose> >= 0.74
 
 =item *
 
-L<MooseX::Object::Pluggable> >= 0.0007
+L<MooseX::Object::Pluggable> >= 0.0009
 
 =item *
 
-L<MooseX::Getopt>
+L<MooseX::Getopt> >= 0.18
 
 =item *
 
-L<namespace::clean>
+L<namespace::autoclean>
 
 =item *
 
@@ -342,11 +384,11 @@ L<File::HomeDir>
 
 =item *
 
-L<Lexical::Persistence>
+L<Task::Weaken>
 
 =item *
 
-L<PPI>
+L<B::Concise>
 
 =item *
 
@@ -354,16 +396,50 @@ L<Term::ANSIColor>
 
 =item *
 
+L<Devel::Peek>
+
+=back
+
+Optionally, some plugins if installed will require the following modules:
+
+=over 4
+
+=item *
+
+L<PPI>
+
+=item *
+
+L<Data::Dump::Streamer>
+
+=item *
+
+L<Data::Dumper::Concise>
+
+=item *
+
+L<File::Next>
+
+=item *
+
+L<Sys::SigAction>
+
+=item *
+
 L<B::Keywords>
 
 =item *
 
-L<Task::Weaken>
+L<Lexical::Persistence>
 
 =item *
 
 L<App::Nopaste>
 
+=item *
+
+L<Module::Refresh>
+
 =back
 
 =head1 AUTHOR
@@ -384,6 +460,18 @@ Matt S Trout - mst (at) shadowcatsystems.co.uk (L<http://www.shadowcatsystems.co
 
 =item Shawn M Moore - sartak (at) gmail.com
 
+=item Oliver Gorwits - oliver on irc.perl.org
+
+=item Andrew Moore - C<< <amoore@cpan.org> >>
+
+=item Norbert Buchmuller C<< <norbi@nix.hu> >>
+
+=item Dave Houston C<< <dhouston@cpan.org> >>
+
+=item Chris Marshall
+
+=item Karen Etheridge C<< <ether@cpan.org> >>
+
 =back
 
 =head1 LICENSE