Return a reference to the correct lexical variable (not the copy)
[p5sagit/Devel-REPL.git] / lib / Devel / REPL / Plugin / LexEnv.pm
index fd91a91..ea6d26b 100644 (file)
@@ -47,8 +47,10 @@ around 'execute' => sub {
 around 'find_variable' => sub {
   my $orig = shift;
   my ($self, $name) = @_;
-  my $variable = $self->lexical_environment->get_context('_')->{$name};
-  return \$variable if $variable;
+
+  return \( $self->lexical_environment->get_context('_')->{$name} )
+    if exists $self->lexical_environment->get_context('_')->{$name};
+
   return $orig->(@_);
 };