This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Stop mod_perl looping forever in &Carp::shortmess_jmp as it somehow
authorNicholas Clark <nick@ccl4.org>
Sun, 26 Nov 2006 12:38:20 +0000 (12:38 +0000)
committerNicholas Clark <nick@ccl4.org>
Sun, 26 Nov 2006 12:38:20 +0000 (12:38 +0000)
manages to forcibly re-load Carp.pm without re-loading Carp/Heavy.pm

p4raw-id: //depot/perl@29382

lib/Carp.pm
lib/Carp/Heavy.pm

index 15e39e5..52ccd76 100644 (file)
@@ -1,6 +1,6 @@
 package Carp;
 
-our $VERSION = '1.06';
+our $VERSION = '1.07';
 # this file is an utra-lightweight stub. The first time a function is
 # called, Carp::Heavy is loaded, and the real short/longmessmess_jmp
 # subs are installed
@@ -32,13 +32,13 @@ sub longmess_jmp  {
     local($@, $!);
     eval { require Carp::Heavy };
     return $@ if $@;
-    goto &longmess_jmp;
+    goto &longmess_real;
 }
 sub shortmess_jmp  {
     local($@, $!);
     eval { require Carp::Heavy };
     return $@ if $@;
-    goto &shortmess_jmp;
+    goto &shortmess_real;
 }
 
 sub croak   { die  shortmess @_ }
index 4355584..d5711ce 100644 (file)
@@ -64,7 +64,12 @@ sub shortmess_real {
 
 # aliasing the whole glob rather than just the CV slot avoids 'redefined'
 # warnings, even in the presence of perl -W (as used by lib/warnings.t !)
+# However it has the potential to create infinite loops, if somehow Carp
+# is forcibly reloaded, but $INC{"Carp/Heavy.pm"} remains true.
+# Hence the extra hack of deleting the previous typeglob first.
 
+delete $Carp::{shortmess_jmp};
+delete $Carp::{longmess_jmp};
 *longmess_jmp  = *longmess_real;
 *shortmess_jmp = *shortmess_real;