This test was relying on a bug in require that causes it to use what-
ever I/O layers are active in require‘s *caller* when opening a file
[perl #96008].
This rewrites the test using the example in ticket #75722.
Since it no longer has anything to do with open.pm, it is now in
t/lib/warnings/perlio.
require './test.pl';
}
-plan 24;
+plan 23;
# open::import expects 'open' as its first argument, but it clashes with open()
sub import {
eval q[use Encode::Alias;use open ":std", ":locale"];
is($@, '', 'can use :std and :locale');
-
- use open IN => ':non-existent';
- eval {
- require Symbol; # Anything that exists but we havn't loaded
- };
- like($@, qr/Can't locate Symbol|Recursive call/i,
- "test for an endless loop in PerlIO_find_layer");
}
{
__END__
+# perlio [PerlIO_find_layer]
+unshift @INC, sub {
+ return undef unless caller eq "main";
+ open my $fh, "<", \1;
+ $fh;
+};
+require Symbol; # doesn't matter whether it exists or no
+EXPECT
+Recursive call to Perl_load_module in PerlIO_find_layer at -e line 2.
+########
+
# perlio [PerlIO_parse_layers]
no warnings 'layer';
open(F, ">:-aa", "bb");