Front page | perl.perl5.porters |
Postings from May 2021
evalbytes example?
From:
Felipe Gasper
Date:
May 19, 2021 15:27
Subject:
evalbytes example?
Message ID:
D52F3921-E22E-412D-9C47-C07FD7B25379@felipegasper.com
Hi all,
Would someone here who understands the matter be able to paste a quick code example that demonstrates the difference between eval and evalbytes, and what the unicode_eval feature does?
I don’t get what the practical difference is from the documentation, and I see no effect in various samples I’m trying.
The only difference at *all* that I see is that evalbytes downgrades the string:
-----
my $e_bytes = q<"é">;
utf8::upgrade($e_bytes);
my @values = (
eval( $e_bytes ),
CORE::evalbytes( $e_bytes ),
);
use Devel::Peek;
Dump $_ for @values;
-----
… but that’s internal to Perl, so I don’t get why there are 2 features for it. And no difference whether the above runs under unicode_eval or not.
I’ve asked in IRC and perused the p5p archives but gotten nowhere. Per this:
https://perl.markmail.org/message/z5mx4m6hkfxs4dvx?q=evalbytes+list:org%2Eperl%2Eperl5-porters+from:%22Father+Chrysostomos%22&page=1
… it seems like `eval("'\x{100}'")` is supposed to behave differently under unicode_eval, but I see no such difference.
Thank you!
-Felipe
-
evalbytes example?
by Felipe Gasper