summaryrefslogtreecommitdiffstats
path: root/lib/Reply/Plugin/Autocomplete/Globals.pm
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-07-04 13:07:16 -0400
committerJesse Luehrs <doy@tozt.net>2013-07-04 13:07:16 -0400
commit903b05bdb8c1224deabd9674bb4be1bae5195312 (patch)
treea9a8d7bf1e8cf44de16981d62bf7b61da1b35c3c /lib/Reply/Plugin/Autocomplete/Globals.pm
parentff42543cec4d93057cdff1ae3a635268d00c0296 (diff)
downloadreply-903b05bdb8c1224deabd9674bb4be1bae5195312.tar.gz
reply-903b05bdb8c1224deabd9674bb4be1bae5195312.zip
refactor this to avoid some duplication
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete/Globals.pm')
-rw-r--r--lib/Reply/Plugin/Autocomplete/Globals.pm7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Globals.pm b/lib/Reply/Plugin/Autocomplete/Globals.pm
index 99ab864..ac2ca3e 100644
--- a/lib/Reply/Plugin/Autocomplete/Globals.pm
+++ b/lib/Reply/Plugin/Autocomplete/Globals.pm
@@ -7,6 +7,8 @@ use base 'Reply::Plugin';
use Package::Stash;
+use Reply::Util qw($fq_ident_rx $fq_varname_rx);
+
=head1 SYNOPSIS
; .replyrc
@@ -32,7 +34,7 @@ sub tab_handler {
my $self = shift;
my ($line) = @_;
- my ($maybe_var) = $line =~ /([\$\@\%\&\*]\s*[0-9A-Z_a-z:]*)$/;
+ my ($maybe_var) = $line =~ /($fq_varname_rx)$/;
return unless $maybe_var;
$maybe_var =~ s/\s+//g;
@@ -90,8 +92,7 @@ sub _recursive_symbols {
# 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;
+ next unless $name =~ /^$fq_ident_rx(?:::)?$/ || length($name) == 1;
if ($name =~ s/::$//) {
my $next = Package::Stash->new(join('::', $stash_name, $name));