From 021f53de09926928546378b3552f9240c9241dde Mon Sep 17 00:00:00 2001 From: Gerard Goossen Date: Mon, 16 Nov 2009 13:58:24 +0100 Subject: Force OP_REQUIRE to scalar context at the end of ck_require and don't let it become void context. Fixes problem with require not always being in scalar context. --- op.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'op.c') diff --git a/op.c b/op.c index f506bff3dd..d4f6fb3ada 100644 --- a/op.c +++ b/op.c @@ -985,7 +985,7 @@ Perl_scalarvoid(pTHX_ OP *o) want = o->op_flags & OPf_WANT; if ((want && want != OPf_WANT_SCALAR) || (PL_parser && PL_parser->error_count) - || o->op_type == OP_RETURN) + || o->op_type == OP_RETURN || o->op_type == OP_REQUIRE) { return o; } @@ -1215,10 +1215,6 @@ Perl_scalarvoid(pTHX_ OP *o) case OP_ENTEREVAL: scalarkids(o); break; - case OP_REQUIRE: - /* all requires must return a boolean value */ - o->op_flags &= ~OPf_WANT; - /* FALL THROUGH */ case OP_SCALAR: return scalar(o); } @@ -1307,10 +1303,6 @@ Perl_list(pTHX_ OP *o) } PL_curcop = &PL_compiling; break; - case OP_REQUIRE: - /* all requires must return a boolean value */ - o->op_flags &= ~OPf_WANT; - return scalar(o); } return o; } @@ -7677,7 +7669,7 @@ Perl_ck_require(pTHX_ OP *o) return newop; } - return ck_fun(o); + return scalar(ck_fun(o)); } OP * -- cgit v1.2.1