ensure failure to load Carp::Heavy gets reported
Dave Mitchell [Mon, 29 May 2006 14:12:13 +0000 (14:12 +0000)]
p4raw-id: //depot/perl@28330

lib/Carp.pm

index c0ffb9c..5545c39 100644 (file)
@@ -28,8 +28,18 @@ sub export_fail { shift; $Verbose = shift if $_[0] eq 'verbose'; @_ }
 sub longmess  { goto &longmess_jmp }
 sub shortmess { goto &shortmess_jmp }
 # these two are replaced when Carp::Heavy is loaded
-sub longmess_jmp  {{ local($@, $!); require Carp::Heavy} goto &longmess_jmp}
-sub shortmess_jmp {{ local($@, $!); require Carp::Heavy} goto &shortmess_jmp}
+sub longmess_jmp  {
+    local($@, $!);
+    eval { require Carp::Heavy };
+    return $@ if $@;
+    goto &longmess_jmp;
+}
+sub shortmess_jmp  {
+    local($@, $!);
+    eval { require Carp::Heavy };
+    return $@ if $@;
+    goto &shortmess_jmp;
+}
 
 sub croak   { die  shortmess @_ }
 sub confess { die  longmess  @_ }