develooper Front page | perl.perl5.porters | Postings from July 2018

Re: Allowing require to return false

Thread Previous | Thread Next
From:
Dave Mitchell
Date:
July 29, 2018 11:24
Subject:
Re: Allowing require to return false
Message ID:
20180729112413.GC2798@iabyn.com
On Fri, Jul 27, 2018 at 02:12:17PM -0500, David Nicol wrote:
> is this subtle difference checked in the test suite?

Changing the die so it behaves the same as false gives the following
failures in t/comp/require.t:

not ok 24 - exp 1; exists $INC{'bleah.pm}
not ok 27 - exp 0; -e flag_file
not ok 28 - exp 0; exists $INC{'bleah.pm}
not ok 30 - cached %INC
not ok 31 - eval { require 'bleah.pm' }
not ok 32 - Compilation failed
not ok 33 - -e flag_file

this is the temp change I made:

diff --git a/pp_ctl.c b/pp_ctl.c
index c046eda267..8be940272b 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1653,7 +1653,8 @@ S_pop_eval_context_maybe_croak(pTHX_ PERL_CONTEXT *cx, SV *errsv, int action)
             errsv = namesv;
         }
         else {
-            (void)hv_store(inc_hv, key, klen, &PL_sv_undef, 0);
+            /* (void)hv_store(inc_hv, key, klen, &PL_sv_undef, 0); */
+            (void)hv_delete(inc_hv, key, klen, G_DISCARD);
             fmt = "%" SVf "Compilation failed in require";
             if (!errsv)
                 errsv = newSVpvs_flags("Unknown error\n", SVs_TEMP);


-- 
I thought I was wrong once, but I was mistaken.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About