Split symbol name instead of munging it in-place
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / CompletionDriver / LexEnv.pm
index ea05e9a..827efb9 100644 (file)
@@ -1,6 +1,6 @@
 package Devel::REPL::Plugin::CompletionDriver::LexEnv;
 use Devel::REPL::Plugin;
-use namespace::clean -except => [ 'meta' ];
+use namespace::autoclean;
 
 sub BEFORE_PLUGIN {
     my $self = shift;
@@ -16,8 +16,8 @@ around complete => sub {
   return $orig->(@_)
     unless $last->isa('PPI::Token::Symbol');
 
-  my $sigil = substr($last, 0, 1, '');
-  my $re = qr/^\Q$last/;
+  my ($sigil, $name) = split(//, $last, 2);
+  my $re = qr/^\Q$name/;
 
   return $orig->(@_),
          # ReadLine is weirdly inconsistent