From 69dc7e4bdb8e397c820e2a9d8685f676602362a6 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 22 Sep 2011 22:29:16 -0700 Subject: [PATCH] Move/rewrite test for Recursive call to Perl_load_module MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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. --- lib/open.t | 9 +-------- t/lib/warnings/perlio | 11 +++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lib/open.t b/lib/open.t index 2f2a04a..3a5565d 100644 --- a/lib/open.t +++ b/lib/open.t @@ -7,7 +7,7 @@ BEGIN { require './test.pl'; } -plan 24; +plan 23; # open::import expects 'open' as its first argument, but it clashes with open() sub import { @@ -186,13 +186,6 @@ SKIP: { 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"); } { diff --git a/t/lib/warnings/perlio b/t/lib/warnings/perlio index 0ccc5a8..a53bece 100644 --- a/t/lib/warnings/perlio +++ b/t/lib/warnings/perlio @@ -24,6 +24,17 @@ Unknown PerlIO layer \"%.*s\" __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"); -- 1.8.3.1