diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-07-04 13:07:16 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-07-04 13:07:16 -0400 |
commit | 903b05bdb8c1224deabd9674bb4be1bae5195312 (patch) | |
tree | a9a8d7bf1e8cf44de16981d62bf7b61da1b35c3c /lib/Reply/Plugin/Autocomplete/Methods.pm | |
parent | ff42543cec4d93057cdff1ae3a635268d00c0296 (diff) | |
download | reply-903b05bdb8c1224deabd9674bb4be1bae5195312.tar.gz reply-903b05bdb8c1224deabd9674bb4be1bae5195312.zip |
refactor this to avoid some duplication
Diffstat (limited to 'lib/Reply/Plugin/Autocomplete/Methods.pm')
-rw-r--r-- | lib/Reply/Plugin/Autocomplete/Methods.pm | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Reply/Plugin/Autocomplete/Methods.pm b/lib/Reply/Plugin/Autocomplete/Methods.pm index 4b1c4f5..7421226 100644 --- a/lib/Reply/Plugin/Autocomplete/Methods.pm +++ b/lib/Reply/Plugin/Autocomplete/Methods.pm @@ -9,6 +9,8 @@ use MRO::Compat; use Package::Stash; use Scalar::Util 'blessed'; +use Reply::Util qw($ident_rx $fq_ident_rx $fq_varname_rx); + =head1 SYNOPSIS ; .replyrc @@ -50,8 +52,10 @@ sub tab_handler { my $self = shift; my ($line) = @_; - my ($invocant, $method) = $line =~ /((?:\$\s*)?[A-Z_a-z][0-9A-Z_a-z:]*)->([A-Z_a-z][0-9A-Z_a-z]*)?$/; + my ($invocant, $method) = $line =~ /($fq_varname_rx|$fq_ident_rx)->($ident_rx)?$/; return unless $invocant; + # XXX unicode + return unless $invocant =~ /^[\$A-Z_a-z]/; $method = '' unless defined $method; |