[Bast-commits] r4410 - trunk/Devel-REPL/lib/Devel/REPL/Plugin

Sartak at dev.catalyst.perl.org Sartak at dev.catalyst.perl.org
Mon May 26 04:20:04 BST 2008


Author: Sartak
Date: 2008-05-26 04:20:03 +0100 (Mon, 26 May 2008)
New Revision: 4410

Modified:
   trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm
Log:
Have LexEnv wrap find_variable to first look at lexical variables. The around doesn't actually take effect for me, for some reason :(


Modified: trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm	2008-05-26 03:19:17 UTC (rev 4409)
+++ trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm	2008-05-26 03:20:03 UTC (rev 4410)
@@ -4,6 +4,8 @@
 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 @@
   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;




More information about the Bast-commits mailing list