X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL.pm;h=9b16f543f264184f161892217ee81952594d423c;hp=d38f3788e3a89e78a5725a6d63fbe0ea5d16c5ab;hb=0e0d2539048eade7dfa30fff6f1ad5b7e90bbf70;hpb=20d9434d701db7e14fe952d73a140d81e88e2f4a diff --git a/lib/Devel/REPL.pm b/lib/Devel/REPL.pm index d38f378..9b16f54 100644 --- a/lib/Devel/REPL.pm +++ b/lib/Devel/REPL.pm @@ -2,32 +2,32 @@ 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.003010'; - 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', required => 1, + is => 'rw', default => sub { 0 } ); @@ -223,7 +223,11 @@ exported functions from that module are available for immediate use: 1 $_ -To quit from the shell, hit C or C. +To quit from the shell, hit C or C. + + MSWin32 NOTE: control keys won't work if TERM=dumb + because readline functionality will be disabled. + =head2 Run Control Files @@ -241,7 +245,7 @@ filename like so: system$ re.pl --rcfile myproject.pc -If the filename happens to contain a forwardslash, then it's used absolutely, +If the filename happens to contain a forward slash, then it's used absolutely, or realive to the current working directory: system$ re.pl --rcfile /path/to/my/project/repl.rc @@ -283,11 +287,39 @@ L L +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + =back =head2 Plugins -Plugins are a way to add funcionality to the REPL shell, and take advantage of +Plugins are a way to add functionality to the REPL shell, and take advantage of C being based on the L object system for Perl 5. This means it's simple to 'hook into' many steps of the R-E-P-L process. Plugins can change the way commands are interpreted, or the way their results are @@ -295,7 +327,9 @@ output, or even add commands to the shell environment. A number of plugins ship with C, 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 manual page, along with links to the manual pages of @@ -328,7 +362,7 @@ the following: =item * -L >= 0.64 +L >= 0.74 =item * @@ -336,23 +370,31 @@ L >= 0.0009 =item * -L >= 0.15 +L >= 0.18 =item * -L >= 0.14 +L =item * -L +L =item * -L +L =item * -L +L + +=item * + +L + +=item * + +L =back @@ -370,10 +412,18 @@ L =item * +L + +=item * + L =item * +L + +=item * + L =item * @@ -416,6 +466,10 @@ Matt S Trout - mst (at) shadowcatsystems.co.uk (L >> +=item Chris Marshall + +=item Karen Etheridge C<< >> + =back =head1 LICENSE