summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-04-01 18:39:43 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2003-04-01 18:39:43 +0000
commita89be09a10c36299e755a956d356eb7f1f643437 (patch)
treefad7397078cfab938793727614ea388a35f3d402 /pp_ctl.c
parentb78f6729f182484e2ef54fb7af30d24d99373338 (diff)
downloadperl-a89be09a10c36299e755a956d356eb7f1f643437.tar.gz
Fix bug #21742. require should be always invoked in
scalar context. This wasn't the case when called from an eval(""), because the void context doesn't propagate through the leaveeval op. Instead of making scalarvoid() handle OP_LEAVEEVAL -- this breaks AutoLoader -- implement a workaround in doeval(). p4raw-id: //depot/perl@19126
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index ac33adf276..0b006855b7 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2884,7 +2884,13 @@ S_doeval(pTHX_ int gimme, OP** startop, CV* outside, U32 seq)
*startop = PL_eval_root;
} else
SAVEFREEOP(PL_eval_root);
- if (gimme & G_VOID)
+ if (gimme & G_VOID && ! PL_in_eval & EVAL_INREQUIRE)
+ /*
+ * EVAL_INREQUIRE (the code is being required) is special-cased :
+ * in this case we want scalar context to be forced, instead
+ * of void context, so a proper return value is returned from
+ * C<require> via this leaveeval op.
+ */
scalarvoid(PL_eval_root);
else if (gimme & G_ARRAY)
list(PL_eval_root);