From 41f767bb6fa8f33b2f4ace0b909969dbcbbc37d5 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sat, 8 Jun 2013 14:13:31 -0500 Subject: allow multiple independent lexical environments --- lib/Reply/Plugin/Defaults.pm | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'lib/Reply/Plugin/Defaults.pm') 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, -- cgit v1.2.3-54-g00ecf