From c9f72cf51b809fe907db1faa4071f0baafeab20c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 27 Jun 2013 17:19:58 -0400 Subject: use the publisher for communicating the lexical environment --- lib/Reply/Plugin/ResultCache.pm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'lib/Reply/Plugin/ResultCache.pm') 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; } -- cgit v1.2.3-54-g00ecf