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

nothingmuch at dev.catalyst.perl.org nothingmuch at dev.catalyst.perl.org
Wed May 14 15:09:42 BST 2008


Author: nothingmuch
Date: 2008-05-14 15:09:42 +0100 (Wed, 14 May 2008)
New Revision: 4384

Modified:
   trunk/Devel-REPL/
   trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm
Log:
 r80567 at dhcp117:  nothingmuch | 2008-05-14 19:51:22 +0900
 preserve $^H and %^H when using the LexEnv plugin



Property changes on: trunk/Devel-REPL
___________________________________________________________________
Name: svk:merge
   - 6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/bast/broken_internets/Devel-REPL:80566
   + 6d2a1d83-d666-409f-9dbf-d3bfcf4e9009:/local/bast/broken_internets/Devel-REPL:80567

Modified: trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm
===================================================================
--- trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm	2008-05-14 14:09:08 UTC (rev 4383)
+++ trunk/Devel-REPL/lib/Devel/REPL/Plugin/LexEnv.pm	2008-05-14 14:09:42 UTC (rev 4384)
@@ -12,6 +12,12 @@
   default => sub { Lexical::Persistence->new }
 );
 
+has '_hints' => (
+  isa => "ArrayRef",
+  is => "rw",
+  predicate => '_has_hints',
+);
+
 around 'mangle_line' => sub {
   my $orig = shift;
   my ($self, @rest) = @_;
@@ -20,8 +26,13 @@
   # Collate my declarations for all LP context vars then add '';
   # so an empty statement doesn't return anything (with a no warnings
   # to prevent "Useless use ..." warning)
-  return join('', map { "my $_;\n" } keys %{$lp->get_context('_')})
-           .qq{{ no warnings 'void'; ''; }\n}.$line;
+  return join('',
+    'BEGIN { if ( $_REPL->_has_hints ) { ( $^H, %^H ) = @{ $_REPL->_hints } } }',
+    ( map { "my $_;\n" } keys %{$lp->get_context('_')} ),
+    qq{{ no warnings 'void'; ''; }\n},
+    $line,
+    '; BEGIN { $_REPL->_hints([ $^H, %^H ]) }',
+  );
 };
 
 around 'execute' => sub {




More information about the Bast-commits mailing list