summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/Reply/Plugin/Defaults.pm9
-rw-r--r--lib/Reply/Plugin/ResultCache.pm5
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/Reply/Plugin/Defaults.pm b/lib/Reply/Plugin/Defaults.pm
index b0c4e88..debed09 100644
--- a/lib/Reply/Plugin/Defaults.pm
+++ b/lib/Reply/Plugin/Defaults.pm
@@ -38,6 +38,15 @@ sub compile {
my $self = shift;
my ($next, $line, %args) = @_;
+ my @envs = (
+ ($args{environment} ? ($args{environment}) : ()),
+ values %{ $args{environments} },
+ );
+
+ if (@envs) {
+ $args{environment} = { map { %$_ } @envs }
+ }
+
return eval_closure(
source => "sub {\n$PREFIX;\n$line\n}",
terse_error => 1,
diff --git a/lib/Reply/Plugin/ResultCache.pm b/lib/Reply/Plugin/ResultCache.pm
index a973d05..91fda37 100644
--- a/lib/Reply/Plugin/ResultCache.pm
+++ b/lib/Reply/Plugin/ResultCache.pm
@@ -36,8 +36,9 @@ sub compile {
my $self = shift;
my ($next, $line, %args) = @_;
- $args{environment} ||= {};
- $args{environment}{'@' . $self->{result_name}} = $self->{results};
+ $args{environments}{''.__PACKAGE__} = {
+ "\@$self->{result_name}" => $self->{results},
+ };
$next->($line, %args);
}