make plugins be M::I features so dependencies are optional
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / CompletionDriver / INC.pm
index d1aa4b3..0daf803 100644 (file)
@@ -4,9 +4,10 @@ use File::Next;
 use File::Spec;
 use namespace::clean -except => [ 'meta' ];
 
-with qw(
-  Devel::REPL::Plugin::Completion
-);
+sub BEFORE_PLUGIN {
+    my $self = shift;
+    $self->load_plugin('Completion');
+}
 
 around complete => sub {
   my $orig = shift;
@@ -75,7 +76,7 @@ around complete => sub {
   my $add_recursively;
   $add_recursively = sub {
     my ($path, $iteration, @more) = @_;
-    opendir((my $dirhandle), $path);
+    opendir((my $dirhandle), $path) || return;
     for (grep { !$ignored{$_} } readdir $dirhandle)
     {
       my $match = $_;