X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=blobdiff_plain;f=lib%2FDevel%2FREPL%2FPlugin%2FCompletionDriver%2FLexEnv.pm;h=cef75c82cb71de80f5130cb4dc3e361c8b09c9cf;hp=cd3ba0be8f5d42fd2c07e719255365404edb9520;hb=1716b20061af51ca82cc543f618f19c1e20f2efa;hpb=6631e15ccd2313ff350fd9bfa44c1ccdbac77100 diff --git a/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm b/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm index cd3ba0b..cef75c8 100644 --- a/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm +++ b/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm @@ -1,11 +1,13 @@ +use strict; +use warnings; package Devel::REPL::Plugin::CompletionDriver::LexEnv; use Devel::REPL::Plugin; -use namespace::clean -except => [ 'meta' ]; +use namespace::autoclean; -with qw( - Devel::REPL::Plugin::Completion - Devel::REPL::Plugin::LexEnv -); +sub BEFORE_PLUGIN { + my $self = shift; + $self->load_plugin('Completion'); +} around complete => sub { my $orig = shift; @@ -16,8 +18,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