Move to Moo for fast bootstrapping.
[p5sagit/Devel-REPL.git] / lib / Devel / REPL.pm
index f8b6f9d..b0fce4e 100644 (file)
@@ -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.003012';
-
-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,
@@ -287,6 +302,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
@@ -299,7 +342,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
@@ -336,19 +381,11 @@ L<Moose> >= 0.74
 
 =item *
 
-L<MooseX::Object::Pluggable> >= 0.0009
-
-=item *
-
 L<MooseX::Getopt> >= 0.18
 
 =item *
 
-L<MooseX::AttributeHelpers> >= 0.16
-
-=item *
-
-L<namespace::clean>
+L<namespace::sweep>
 
 =item *