The message "Can't upgrade that kind of scalar" can be far more
Nicholas Clark [Sun, 5 Feb 2006 20:51:43 +0000 (20:51 +0000)]
informative.

p4raw-id: //depot/perl@27095

pod/perldiag.pod
sv.c

index 5e16420..8509f6c 100644 (file)
@@ -1076,7 +1076,7 @@ redefined subroutine while the old routine is running.  Go figure.
 (F) You tried to unshift an "unreal" array that can't be unshifted, such
 as the main Perl stack.
 
-=item Can't upgrade that kind of scalar
+=item Can't upgrade %s (%d) to %d
 
 (P) The internal sv_upgrade routine adds "members" to an SV, making it
 into a more specialized kind of SV.  The top several SV types are so
diff --git a/sv.c b/sv.c
index 36cea18..d7703e2 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1147,7 +1147,8 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 new_type)
        break;
     default:
        if (old_type_details->cant_upgrade)
-           Perl_croak(aTHX_ "Can't upgrade that kind of scalar");
+           Perl_croak(aTHX_ "Can't upgrade %s (%" UVuf ") to %" UVuf,
+                      sv_reftype(sv, 0), (UV) old_type, (UV) new_type);
     }
 
     SvFLAGS(sv) &= ~SVTYPEMASK;