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=b0fce4e4b2d9dfb1e911815169a347244622309d;hp=a77dcaf43f9d4a3c82d5c56b2ae2f079f3ba0acb;hb=e2d0b0198529e2e06593df8ebab7a8413bc932e1;hpb=67a934781bbbb30cfc24729ab642e6386bc469c5 diff --git a/lib/Devel/REPL.pm b/lib/Devel/REPL.pm index a77dcaf..b0fce4e 100644 --- a/lib/Devel/REPL.pm +++ b/lib/Devel/REPL.pm @@ -1,15 +1,30 @@ package Devel::REPL; use Term::ReadLine; -use Moose; -use namespace::clean -except => [ 'meta' ]; +use Moo; +use namespace::sweep; use 5.008001; # backwards compat, doesn't warn like 5.8.1 -our $VERSION = '1.003010_01'; - -with 'MooseX::Object::Pluggable'; +our $VERSION = '1.003014'; use Devel::REPL::Error; +use Scalar::Util qw/blessed/; +use Module::Runtime (); + +sub load_plugin { + my ($self, $plugin) = @_; + $plugin = "Devel::REPL::Plugin::$plugin"; + Module::Runtime::use_module("$plugin"); + if (my $pre = $plugin->can('BEFORE_PLUGIN')) { + $pre->($self, $plugin); + } + Moo::Role->apply_roles_to_package( + 'Devel::REPL', $plugin + ); + if (my $pre = $plugin->can('AFTER_PLUGIN')) { + $pre->($self, $plugin); + } +} has 'term' => ( is => 'rw', required => 1, @@ -223,7 +238,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 @@ -283,6 +302,34 @@ L L +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + +=item * + +L + =back =head2 Plugins @@ -295,7 +342,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,31 +377,35 @@ the following: =item * -L >= 0.64 +L >= 0.74 =item * -L >= 0.0009 +L >= 0.18 =item * -L >= 0.15 +L =item * -L >= 0.14 +L =item * -L +L =item * -L +L =item * -L +L + +=item * + +L =back @@ -370,10 +423,18 @@ L =item * +L + +=item * + L =item * +L + +=item * + L =item * @@ -416,6 +477,8 @@ Matt S Trout - mst (at) shadowcatsystems.co.uk (L >> +=item Chris Marshall + =back =head1 LICENSE