summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-07-01 21:44:21 -0400
committerJesse Luehrs <doy@tozt.net>2013-07-01 21:50:02 -0400
commitcad6d9c60381336517831443f1fbec69ff498fb0 (patch)
tree0c2ab6d1788a801537ebc7ea9e43dd2cb207ade3
parentbffca5dc5c279ad3dd89a4fd734c5f5c5d906155 (diff)
downloadreply-cad6d9c60381336517831443f1fbec69ff498fb0.tar.gz
reply-cad6d9c60381336517831443f1fbec69ff498fb0.zip
avoid dying when checking weird stash entries for completions
-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;