manages to forcibly re-load Carp.pm without re-loading Carp/Heavy.pm
p4raw-id: //depot/perl@29382
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
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 @_ }
# 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;