From: Dagfinn Ilmari Mannsåker Date: Wed, 6 Feb 2013 11:45:57 +0000 (+0000) Subject: Split symbol name instead of munging it in-place X-Git-Tag: v1.003015~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9b7bfb6ac233dca407f12db47aa8dda7c9c1d338;p=p5sagit%2FDevel-REPL.git Split symbol name instead of munging it in-place It's actually an object (with string overload), so this avoids an "Attempt to use reference as lvalue in substr" warning on perl 5.16. --- diff --git a/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm b/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm index 133baaf..827efb9 100644 --- a/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm +++ b/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm @@ -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