summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorBrian Fraser <fraserbn@gmail.com>2011-09-22 22:31:46 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-22 22:31:46 -0700
commit639dfab029654a3b066df400686e1acdaae62762 (patch)
treef81d1af8a2e388554711e4a87393cd1ec7e334e6 /pp_ctl.c
parent69dc7e4bdb8e397c820e2a9d8685f676602362a6 (diff)
downloadperl-639dfab029654a3b066df400686e1acdaae62762.tar.gz
[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.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 52b0682d0d..054de67e28 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3634,7 +3634,7 @@ S_check_type_and_open(pTHX_ SV *name)
}
#if !defined(PERLIO_IS_STDIO) && !defined(USE_SFIO)
- return PerlIO_openn(aTHX_ NULL, PERL_SCRIPT_MODE, -1, 0, 0, NULL, 1, &name);
+ return PerlIO_openn(aTHX_ ":", PERL_SCRIPT_MODE, -1, 0, 0, NULL, 1, &name);
#else
return PerlIO_open(p, PERL_SCRIPT_MODE);
#endif