From 3c80d9cb9c7c095b7d176a3dd225083f0e9706fb Mon Sep 17 00:00:00 2001 From: Toby Inkster Date: Fri, 28 Jun 2013 10:41:18 +0100 Subject: listen to events published by Packages plugin to find out the names of more packages for autocompletion --- lib/Reply/Plugin/Autocomplete/Packages.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/Reply/Plugin/Autocomplete/Packages.pm b/lib/Reply/Plugin/Autocomplete/Packages.pm index d247baa..6e6037d 100644 --- a/lib/Reply/Plugin/Autocomplete/Packages.pm +++ b/lib/Reply/Plugin/Autocomplete/Packages.pm @@ -43,7 +43,19 @@ sub tab_handler { } } + push @results, + grep m/^\Q$package_fragment/, + @{$self->{moar_packages}||=[]}; + return @results; } +# listen for events from the Packages plugin, for its wise wisdom +# can teach us about packages that are not in %INC +sub package { + my $self = shift; + my ($pkg) = @_; + push @{$self->{moar_packages}||=[]}, $pkg; +} + 1; -- cgit v1.2.3-54-g00ecf