From 7d7892821ccfd0b84576fc06764ec467e8ca7678 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Sun, 30 Oct 2011 14:33:06 -0700 Subject: Add evalbytes function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This function evaluates its argument as a byte string, regardless of the internal encoding. It croaks if the string contains characters outside the byte range. Hence evalbytes(" use utf8; '\xc4\x80' ") will return "\x{100}", even if the original string had the UTF8 flag on, and evalbytes(" '\xc4\x80' ") will return "\xc4\x80". This has the side effect of fixing the deparsing of CORE::break under ‘use feature’ when there is an override. --- toke.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'toke.c') diff --git a/toke.c b/toke.c index 3720a83101..b1acdd3408 100644 --- a/toke.c +++ b/toke.c @@ -7248,6 +7248,10 @@ Perl_yylex(pTHX) UNIBRACK(OP_ENTEREVAL); } + case KEY_evalbytes: + PL_expect = XTERM; + UNIBRACK(-OP_ENTEREVAL); + case KEY_eof: UNI(OP_EOF); -- cgit v1.2.1