BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

I was playing around with tie, tying various special variables and stuff when I encountered a error I've not seen before: "Can't upgrade that kind of scalar...".

A Google turns up quite a few references to this, but none that explain what it means or how to fix it.

None that is until it turned up this perlman:perldiag right here at the monastery which reads:

Can't upgrade that kind of scalar

(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 specialized, however, that they cannot be interconverted. This message indicates that such a conversion was attempted.

In this case, should I read that to mean: You cannot tie that variable, so stop trying?

The reason for asking for clarification is that the actual tie statement went ahead without comment. It was only when doing something ostensibly unrelated--though I realise it is--that the error occurs:

use X; BEGIN{ tie %::, 'X'; } ... require IO::Socket; ## This causes the "Can't upgrade that type of sc +alar"

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

Replies are listed 'Best First'.
Re: Fatal error: "Can't upgrade that kind of scalar"
by Anonymous Monk on Aug 15, 2007 at 08:21 UTC
    You cannot tie that variable, so stop trying?
    Yes. %:: is super special
      I can't find %:: in my list of special variables. What is its purpose if it is so super special? (Or is it also super secret?)