make plugins be M::I features so dependencies are optional
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / CompletionDriver / INC.pm
index a47bc96..0daf803 100644 (file)
@@ -4,6 +4,11 @@ use File::Next;
 use File::Spec;
 use namespace::clean -except => [ 'meta' ];
 
+sub BEFORE_PLUGIN {
+    my $self = shift;
+    $self->load_plugin('Completion');
+}
+
 around complete => sub {
   my $orig = shift;
   my ($self, $text, $document) = @_;
@@ -71,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 = $_;
@@ -121,5 +126,9 @@ __END__
 
 Devel::REPL::Plugin::CompletionDriver::INC - Complete module names in use and require
 
+=head1 AUTHOR
+
+Shawn M Moore, C<< <sartak at gmail dot com> >>
+
 =cut