X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FCompletionDriver%2FINC.pm;h=de95a224972126e1efcadb743e8c1df601d232f7;hp=a47bc96c376400b67f40bd90d85efe9f05a9ae7d;hb=HEAD;hpb=cfd1094b45c394258ccda08216f1435bf40e1d50 diff --git a/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm b/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm index a47bc96..de95a22 100644 --- a/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm +++ b/lib/Devel/REPL/Plugin/CompletionDriver/INC.pm @@ -1,8 +1,20 @@ +use strict; +use warnings; package Devel::REPL::Plugin::CompletionDriver::INC; +# ABSTRACT: Complete module names in use and require + +our $VERSION = '1.003030'; + 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; + +sub BEFORE_PLUGIN { + my $self = shift; + $self->load_plugin('Completion'); +} around complete => sub { my $orig = shift; @@ -58,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 = ( @@ -71,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 = $_; @@ -94,7 +106,7 @@ around complete => sub { } }; - # look through all of + # look through all of INC: for (@INC) { my $path = $_; @@ -117,9 +129,10 @@ around complete => sub { __END__ -=head1 NAME +=pod -Devel::REPL::Plugin::CompletionDriver::INC - Complete module names in use and require +=head1 AUTHOR -=cut +Shawn M Moore, C<< >> +=cut