From: Nicholas Clark Date: Sun, 26 Nov 2006 12:38:20 +0000 (+0000) Subject: Stop mod_perl looping forever in &Carp::shortmess_jmp as it somehow X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=792941b2ff890591e57d24cadb288f2aa39dfb7b;p=p5sagit%2Fp5-mst-13.2.git Stop mod_perl looping forever in &Carp::shortmess_jmp as it somehow manages to forcibly re-load Carp.pm without re-loading Carp/Heavy.pm p4raw-id: //depot/perl@29382 --- diff --git a/lib/Carp.pm b/lib/Carp.pm index 15e39e5..52ccd76 100644 --- a/lib/Carp.pm +++ b/lib/Carp.pm @@ -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 @_ } diff --git a/lib/Carp/Heavy.pm b/lib/Carp/Heavy.pm index 4355584..d5711ce 100644 --- a/lib/Carp/Heavy.pm +++ b/lib/Carp/Heavy.pm @@ -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;