summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Autocomplete/Globals.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete/Globals.pm')
-rw-r--r--lib/Reply/Plugin/Autocomplete/Globals.pm9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Globals.pm b/lib/Reply/Plugin/Autocomplete/Globals.pm
index 4346544..1d043ff 100644
--- a/lib/Reply/Plugin/Autocomplete/Globals.pm
+++ b/lib/Reply/Plugin/Autocomplete/Globals.pm
@@ -83,6 +83,15 @@ sub _recursive_symbols {
my @symbols;
for my $name ($stash->list_all_symbols) {
+ # main can have things in it like "_<reader Foo::bar (defined at ...)"
+ # which aren't real variables - don't complete them, because we only
+ # care about things that can be used as literal variable names. be sure
+ # to not also block out punctuation variables.
+ # XXX fix for unicode
+ # XXX fix for variables like ${^GLOBAL_PHASE}
+ next unless $name =~ /^[A-Z_a-z][0-9A-Z_a-z]*(?:::)?$/
+ || length($name) == 1;
+
if ($name =~ s/::$//) {
my $next = Package::Stash->new(join('::', $stash_name, $name));
next if $next->namespace == $stash->namespace;