Please sign in to comment.
[perl #96008] use and require are affected by the open pragma
% perl -e 'print "package F;\n # \xF1\n;1;"' > x.pl % perl '-Mopen=:encoding(utf8)' -e 'require "x.pl"' utf8 "\xF1" does not map to Unicode at x.pl line 1. Bit of a surprising discovery; Turns out that passing a single ":" for the layers skips the fetch from the context layers: perl -wE 'use open qw( :encoding(UTF-8) ); open my $fh, "<:", "etc"; say PerlIO::get_layers($fh);' That will only get the relevant default layers, while removing the colons makes it work as usual -- So we can abuse this (mis)feature to fix the bug.
- Loading branch information...