summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-07-10 10:16:11 -0400
committerJesse Luehrs <doy@tozt.net>2013-07-10 10:16:11 -0400
commit691c1f74f58b14270d246fb78e2697d718822079 (patch)
tree789d6f997b4cc93f1bdf70e880277265d2e199a0
parentf6d24b6c06464b1c0aaf578ce0aaff302a015763 (diff)
downloadreply-691c1f74f58b14270d246fb78e2697d718822079.tar.gz
reply-691c1f74f58b14270d246fb78e2697d718822079.zip
only add newly declared variables here
-rw-r--r--lib/Reply/Plugin/LexicalPersistence.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Reply/Plugin/LexicalPersistence.pm b/lib/Reply/Plugin/LexicalPersistence.pm
index 2e972bf..8286aef 100644
--- a/lib/Reply/Plugin/LexicalPersistence.pm
+++ b/lib/Reply/Plugin/LexicalPersistence.pm
@@ -5,7 +5,7 @@ use warnings;
use base 'Reply::Plugin';
-use PadWalker 'peek_sub';
+use PadWalker 'peek_sub', 'closed_over';
=head1 SYNOPSIS
@@ -36,9 +36,12 @@ sub compile {
my ($code) = $next->($line, %args);
+ my $new_env = peek_sub($code);
+ delete $new_env->{$_} for keys %{ closed_over($code) };
+
$self->{env} = {
%{ $self->{env} },
- %{ peek_sub($code) },
+ %$new_env,
};
return $code;