From: Nicholas Clark Date: Sun, 5 Feb 2006 20:51:43 +0000 (+0000) Subject: The message "Can't upgrade that kind of scalar" can be far more X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c81225bc5ae0284701281258d95603e8bac4bf46;p=p5sagit%2Fp5-mst-13.2.git The message "Can't upgrade that kind of scalar" can be far more informative. p4raw-id: //depot/perl@27095 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 5e16420..8509f6c 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -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 --- 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;