X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FCompletionDriver%2FINC.pm;h=90eba7e6ac08a4158c7b54405aa2f760ba238300;hb=796cd7ec80de14e45ca8221d545aceb7b9bc0b71;hp=d1aa4b3e8a783b2a40fd91713622d0a1d6b6cb08;hpb=6631e15ccd2313ff350fd9bfa44c1ccdbac77100;p=p5sagit%2FDevel-REPL.git diff --git a/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm b/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm index d1aa4b3..90eba7e 100644 --- a/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm +++ b/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm @@ -1,12 +1,20 @@ +use strict; +use warnings; package Devel::REPL::Plugin::CompletionDriver::INC; +# ABSTRACT: Complete module names in use and require + +our $VERSION = '1.003027'; + use Devel::REPL::Plugin; +use Devel::REPL::Plugin::Completion; # die early if cannot load use File::Next; use File::Spec; -use namespace::clean -except => [ 'meta' ]; +use namespace::autoclean; -with qw( - Devel::REPL::Plugin::Completion -); +sub BEFORE_PLUGIN { + my $self = shift; + $self->load_plugin('Completion'); +} around complete => sub { my $orig = shift; @@ -62,7 +70,7 @@ around complete => sub { my @found; # most VCSes don't litter every single fucking directory with garbage. if you - # know of any other, just stick them in here. noone wants to complete + # know of any other, just stick them in here. No one wants to complete # Devel::REPL::Plugin::.svn my %ignored = ( @@ -75,7 +83,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 = $_; @@ -98,7 +106,7 @@ around complete => sub { } }; - # look through all of + # look through all of INC: for (@INC) { my $path = $_; @@ -121,13 +129,10 @@ around complete => sub { __END__ -=head1 NAME - -Devel::REPL::Plugin::CompletionDriver::INC - Complete module names in use and require +=pod =head1 AUTHOR Shawn M Moore, C<< >> =cut -