From: Sartak Date: Sat, 31 May 2008 15:57:22 +0000 (+0000) Subject: r61338@onn: sartak | 2008-05-31 11:57:10 -0400 X-Git-Tag: v1.003015~92 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=06df07674a6770b9bef20bff5bebc7ce648d4f35;p=p5sagit%2FDevel-REPL.git r61338@onn: sartak | 2008-05-31 11:57:10 -0400 Fake $_REPL being in the lexical environment for some completion stuff git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@4443 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm b/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm index 87a588f..44de708 100644 --- a/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm +++ b/lib/Devel/REPL/Plugin/CompletionDriver/LexEnv.pm @@ -27,7 +27,7 @@ around complete => sub { map { $sigil eq '%' ? '%' . $_ : $_ } grep { /$re/ } map { substr($_, 1) } # drop lexical's sigil - keys %{$self->lexical_environment->get_context('_')}; + '$_REPL', keys %{$self->lexical_environment->get_context('_')}; }; 1; diff --git a/lib/Devel/REPL/Plugin/FindVariable.pm b/lib/Devel/REPL/Plugin/FindVariable.pm index ef6314a..d704dea 100644 --- a/lib/Devel/REPL/Plugin/FindVariable.pm +++ b/lib/Devel/REPL/Plugin/FindVariable.pm @@ -6,6 +6,8 @@ use namespace::clean -except => [ 'meta' ]; sub find_variable { my ($self, $name) = @_; + return \$self if $name eq '$_REPL'; + # XXX: this code needs to live in LexEnv if ($self->can('lexical_environment')) { return \( $self->lexical_environment->get_context('_')->{$name} )