t/lib/indirect/TestRequired4/a0.pm
t/lib/indirect/TestRequired4/b0.pm
t/lib/indirect/TestRequired4/c0.pm
+t/lib/indirect/TestRequired5/a0.pm
+t/lib/indirect/TestRequired5/b0.pm
+t/lib/indirect/TestRequired5/c0.pm
+t/lib/indirect/TestRequired5/d0.pm
my $tests;
BEGIN { $tests = 18 }
-use Test::More tests => (1 + $tests + 1) + 3 + 3 + 3 + 5 + 4 + 2;
+use Test::More tests => (1 + $tests + 1) + 3 + 3 + 3 + 5 + 4 + 3;
BEGIN { delete $ENV{PERL_INDIRECT_PM_DISABLE} }
like $err, qr/^Can't locate object method "new" via package "X"/, 'RT #50570';
}
+# This test must be in the topmost scope
+BEGIN { eval 'use indirect::TestRequired5::a0' }
+my $err = indirect::TestRequired5::a0::error();
+like $err, qr/^Can't locate object method "new" via package "X"/,
+ 'identifying requires by their eval context pointer is not enough';
+
__DATA__
my $a = new P1;
--- /dev/null
+package indirect::TestRequired5::a0;
+no indirect ":fatal";
+use indirect::TestRequired5::b0;
+sub error {
+ local $@;
+ indirect::TestRequired5::b0->get;
+ return $@;
+}
+1;
--- /dev/null
+package indirect::TestRequired5::b0;
+sub get {
+ eval 'require indirect::TestRequired5::c0';
+}
+1;
--- /dev/null
+package indirect::TestRequired5::c0;
+require indirect::TestRequired5::d0;
+1;
--- /dev/null
+package indirect::TestRequired5::d0;
+new X;
+1;