diff options
author | Jesse Luehrs <doy@tozt.net> | 2013-06-27 17:19:58 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2013-06-27 17:19:58 -0400 |
commit | c9f72cf51b809fe907db1faa4071f0baafeab20c (patch) | |
tree | b2fb4cb637e034f0a8edc49672152a69ee8dfcbc /lib/Reply/Plugin/LexicalPersistence.pm | |
parent | 90ec7c86880fbd5ecc3ab09b111194a90c0ab06a (diff) | |
download | reply-c9f72cf51b809fe907db1faa4071f0baafeab20c.tar.gz reply-c9f72cf51b809fe907db1faa4071f0baafeab20c.zip |
use the publisher for communicating the lexical environment
Diffstat (limited to 'lib/Reply/Plugin/LexicalPersistence.pm')
-rw-r--r-- | lib/Reply/Plugin/LexicalPersistence.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Reply/Plugin/LexicalPersistence.pm b/lib/Reply/Plugin/LexicalPersistence.pm index 44b2ef8..99c328c 100644 --- a/lib/Reply/Plugin/LexicalPersistence.pm +++ b/lib/Reply/Plugin/LexicalPersistence.pm @@ -22,8 +22,12 @@ then use C<$x> as expected in subsequent lines. sub new { my $class = shift; + my %opts = @_; + my $self = $class->SUPER::new(@_); $self->{env} = {}; + $self->{publisher} = $opts{publisher}; + return $self; } @@ -31,12 +35,6 @@ sub compile { my $self = shift; my ($next, $line, %args) = @_; - $args{environment} ||= {}; - $args{environment} = { - %{ $args{environment} }, - %{ $self->{env} }, - }; - my ($code) = $next->($line, %args); $self->{env} = { @@ -44,6 +42,8 @@ sub compile { %{ peek_sub($code) }, }; + $self->{publisher}->('lexical_environment', default => $self->{env}); + return $code; } |