Subject: | Needs to handle list context |
Devel::EvalContext forces everything to scalar context. The problem is
this line:
$user_retval = $evaluator->($code);
Attached is a patch that fixes this.
Subject: | list_context.diff |
--- EvalContext.pm 2007-07-06 12:12:51.000000000 -0400
+++ EvalContext.pm.new 2007-07-06 12:13:21.000000000 -0400
@@ -147,7 +147,17 @@
$code = qq[$prologue\n#line 1 "<interactive>"\n$code\n];
_warn "code:\n"; _warnblock($code);
- my $user_retval = $evaluator->($code);
+ my @user_retval;
+
+ if (wantarray)
+ {
+ @user_retval = $evaluator->($code);
+ }
+ else
+ {
+ $user_retval[0] = $evaluator->($code);
+ }
+
my $user_error = $@;
# A = $user_error
@@ -183,10 +193,10 @@
croak "Devel::EvalContext::run: internal error: not saved but no error"
unless $_new_context->{saved};
- _warn "retval: $user_retval\n";
+ _warn "retval: @user_retval\n";
$$cxt = $_new_context;
- return (undef, $user_retval);
+ return (undef, @user_retval);
}
1;