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/ResultCache.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/ResultCache.pm')
-rw-r--r-- | lib/Reply/Plugin/ResultCache.pm | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/lib/Reply/Plugin/ResultCache.pm b/lib/Reply/Plugin/ResultCache.pm index 91fda37..713a7fd 100644 --- a/lib/Reply/Plugin/ResultCache.pm +++ b/lib/Reply/Plugin/ResultCache.pm @@ -28,21 +28,11 @@ sub new { my $self = $class->SUPER::new(@_); $self->{results} = []; $self->{result_name} = $opts{variable} || 'res'; + $self->{publisher} = $opts{publisher}; return $self; } -sub compile { - my $self = shift; - my ($next, $line, %args) = @_; - - $args{environments}{''.__PACKAGE__} = { - "\@$self->{result_name}" => $self->{results}, - }; - - $next->($line, %args); -} - sub execute { my $self = shift; my ($next, @args) = @_; @@ -55,6 +45,13 @@ sub execute { push @{ $self->{results} }, \@res; } + $self->{publisher}->( + 'lexical_environment', + result_cache => { + "\@$self->{result_name}" => $self->{results}, + }, + ); + return @res; } |