[Bast-commits] r4415 - in trunk/Devel-REPL: . lib/Devel/REPL/Plugin

Sartak at dev.catalyst.perl.org Sartak at dev.catalyst.perl.org
Tue May 27 02:31:54 BST 2008


Author: Sartak
Date: 2008-05-27 02:31:53 +0100 (Tue, 27 May 2008)
New Revision: 4415

Modified:
   trunk/Devel-REPL/
   trunk/Devel-REPL/lib/Devel/REPL/Plugin/FindVariable.pm
   trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm
Log:
 r61086 at onn:  sartak | 2008-05-26 21:31:16 -0400
 Hack to make LexEnv + FindVariable work (which makes lexical-object method name completion work)



Property changes on: trunk/Devel-REPL
___________________________________________________________________
Name: svk:merge
   - 6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/bast/broken_internets/Devel-REPL:80567
   + 08e7d58d-de06-4458-8c15-335e402ab116:/local/Devel-REPL:61086
6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/bast/broken_internets/Devel-REPL:80567

Modified: trunk/Devel-REPL/lib/Devel/REPL/Plugin/FindVariable.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Plugin/FindVariable.pm	2008-05-27 01:20:12 UTC (rev 4414)
+++ trunk/Devel-REPL/lib/Devel/REPL/Plugin/FindVariable.pm	2008-05-27 01:31:53 UTC (rev 4415)
@@ -6,6 +6,12 @@
 sub find_variable {
     my ($self, $name) = @_;
 
+    # XXX: this code needs to live in LexEnv
+    if ($self->can('lexical_environment')) {
+        return \( $self->lexical_environment->get_context('_')->{$name} )
+            if exists $self->lexical_environment->get_context('_')->{$name};
+    }
+
     my $sigil = $name =~ s/^([\$\@\%\&\*])// ? $1 : '';
 
     my $default_package = $self->can('current_package')

Modified: trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm	2008-05-27 01:20:12 UTC (rev 4414)
+++ trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm	2008-05-27 01:31:53 UTC (rev 4415)
@@ -44,14 +44,17 @@
   return $self->$orig($wrapped, @rest);
 };
 
-around 'find_variable' => sub {
-  my $orig = shift;
-  my ($self, $name) = @_;
+# this doesn't work! yarg. we now just check $self->can('lexical_environment')
+# in FindVariable
 
-  return \( $self->lexical_environment->get_context('_')->{$name} )
-    if exists $self->lexical_environment->get_context('_')->{$name};
+#around 'find_variable' => sub {
+#  my $orig = shift;
+#  my ($self, $name) = @_;
+#
+#  return \( $self->lexical_environment->get_context('_')->{$name} )
+#    if exists $self->lexical_environment->get_context('_')->{$name};
+#
+#  return $orig->(@_);
+#};
 
-  return $orig->(@_);
-};
-
 1;




More information about the Bast-commits mailing list