RT #131098
5.8.0 introduced a change which as an inadvertent side-effect caused
this @INC-related require croak message:
Can't locate foo in @INC (@INC contains: ...) at ...
to be emitted even when foo is a non-searchable pathname (like /foo or
./foo) and @INC isn't used.
This commit reverts the error message in these cases to be the simple
Can't locate foo at ...
DIE(aTHX_ "Can't locate %s: %s: %s",
name, tryname, Strerror(saved_errno));
} else {
- if (namesv) { /* did we lookup @INC? */
+ if (path_searchable) { /* did we lookup @INC? */
AV * const ar = GvAVn(PL_incgv);
SSize_t i;
SV *const msg = newSVpvs_flags("", SVs_TEMP);
use strict;
use warnings;
-plan(tests => 27);
+plan(tests => 28);
my $nonfile = tempfile();
eval { do "" };
like $@, qr/^Missing or undefined argument to do /;
+
+# non-searchable pathnames shouldn't mention @INC in the error
+
+my $nonsearch = "./no_such_file.pm";
+
+eval "require \"$nonsearch\"";
+
+like $@, qr/^Can't locate \Q$nonsearch\E at/,
+ "correct error message for require $nonsearch";