Skip to content
Permalink
Browse files

Allow require to return false

  • Loading branch information...
dnmfarrell committed Jul 21, 2018
1 parent 1e98119 commit a27d5730eca477a85b81f3226c13ba87f52b5857
Showing with 2 additions and 9 deletions.
  1. +2 −9 pp_ctl.c
@@ -4507,7 +4507,6 @@ PP(pp_leaveeval)
U8 gimme;
PERL_CONTEXT *cx;
OP *retop;
int failed;
CV *evalcv;
bool keep;

@@ -4519,12 +4518,6 @@ PP(pp_leaveeval)
oldsp = PL_stack_base + cx->blk_oldsp;
gimme = cx->blk_gimme;

/* did require return a false value? */
failed = CxOLD_OP_TYPE(cx) == OP_REQUIRE
&& !(gimme == G_SCALAR
? SvTRUE_NN(*PL_stack_sp)
: PL_stack_sp > oldsp);

if (gimme == G_VOID) {
PL_stack_sp = oldsp;
/* free now to avoid late-called destructors clobbering $@ */
@@ -4550,8 +4543,8 @@ PP(pp_leaveeval)
#endif
CvDEPTH(evalcv) = 0;

/* pop the CXt_EVAL, and if a require failed, croak */
S_pop_eval_context_maybe_croak(aTHX_ cx, NULL, failed);
/* pop the CXt_EVAL */
S_pop_eval_context_maybe_croak(aTHX_ cx, NULL, 0);

if (!keep)
CLEAR_ERRSV();

0 comments on commit a27d573

Please sign in to comment.
You can’t perform that action at this time.