diff options
-rw-r--r-- | pp_ctl.c | 3 | ||||
-rw-r--r-- | t/comp/require.t | 16 |
2 files changed, 17 insertions, 2 deletions
@@ -3467,9 +3467,10 @@ S_doopen_pm(pTHX_ SV *name) PERL_ARGS_ASSERT_DOOPEN_PM; if (namelen > 3 && memEQs(p + namelen - 3, 3, ".pm")) { - SV *const pmcsv = sv_mortalcopy(name); + SV *const pmcsv = sv_newmortal(); Stat_t pmcstat; + SvSetSV_nosteal(pmcsv,name); sv_catpvn(pmcsv, "c", 1); if (PerlLIO_stat(SvPV_nolen_const(pmcsv), &pmcstat) >= 0) diff --git a/t/comp/require.t b/t/comp/require.t index d4ca56c077..4200004113 100644 --- a/t/comp/require.t +++ b/t/comp/require.t @@ -22,7 +22,7 @@ krunch.pm krunch.pmc whap.pm whap.pmc); my $Is_EBCDIC = (ord('A') == 193) ? 1 : 0; my $Is_UTF8 = (${^OPEN} || "") =~ /:utf8/; -my $total_tests = 50; +my $total_tests = 51; if ($Is_EBCDIC || $Is_UTF8) { $total_tests -= 3; } print "1..$total_tests\n"; @@ -259,6 +259,20 @@ EOT } } +# Test "require func()" with abs path when there is no .pmc file. +++$::i; +require Cwd; +require File::Spec::Functions; +eval { + CORE::require(File::Spec::Functions::catfile(Cwd::getcwd(),"bleah.pm")); +}; +if ($@ =~ /^This is an expected error/) { + print "ok $i\n"; +} else { + print "not ok $i\n"; +} + + ########################################## # What follows are UTF-8 specific tests. # # Add generic tests before this point. # |