From: Sartak Date: Mon, 26 May 2008 03:20:03 +0000 (+0000) Subject: Have LexEnv wrap find_variable to first look at lexical variables. The around doesn... X-Git-Tag: v1.003015~99 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FDevel-REPL.git;a=commitdiff_plain;h=bd67131f89dd3b141458a20e3b456f23d6f62ee0 Have LexEnv wrap find_variable to first look at lexical variables. The around doesn't actually take effect for me, for some reason :( git-svn-id: http://dev.catalyst.perl.org/repos/bast/trunk/Devel-REPL@4410 bd8105ee-0ff8-0310-8827-fb3f25b6796d --- diff --git a/lib/Devel/REPL/Plugin/LexEnv.pm b/lib/Devel/REPL/Plugin/LexEnv.pm index 2d48746..fd91a91 100644 --- a/lib/Devel/REPL/Plugin/LexEnv.pm +++ b/lib/Devel/REPL/Plugin/LexEnv.pm @@ -4,6 +4,8 @@ use Moose::Role; use namespace::clean -except => [ 'meta' ]; use Lexical::Persistence; +with 'Devel::REPL::Plugin::FindVariable'; + has 'lexical_environment' => ( isa => 'Lexical::Persistence', is => 'rw', @@ -42,4 +44,12 @@ around 'execute' => sub { return $self->$orig($wrapped, @rest); }; +around 'find_variable' => sub { + my $orig = shift; + my ($self, $name) = @_; + my $variable = $self->lexical_environment->get_context('_')->{$name}; + return \$variable if $variable; + return $orig->(@_); +}; + 1;