"Jan Dubois" ([EMAIL PROTECTED]) writes: > In particular, you cannot update hash keys in-place at all: besides > them sharing memory in a shared hash key table, you would also end > up with a different hash for the new key, so you would be breaking > hash lookup. If you want to change the hash key, you need to remove > the entry using the old key and add it back using the new key. Yes, that is clear to me. And in this I need to create a entirely new hash, as the caller's hash should be unmolested.
Keep in mind that the first example I had was just a starting point. > And trust me, if this is an external API, then people will eventually > pass things like lvalue substr() expressions, $1 regexp variables, > tied hash elements etc. to your code. Treating everything correctly > at the XS level is quite a bit of work, especially if you want to > support older Perl versions too. My module requires 5.8.3, so far so good. Good point about substr and the like. Nevertheless, I settled on a solution, where I write the text in the new codepage into a new buffer, and then I copy that text into the sv with sv_setpvn. I found that in this case it works even if I pass $key directly. No, it does not work with substr, nor does it work if I pass a constant - in the latter case it's bye-bye. I will have to document this. Thanks for your comments, Jan! -- Erland Sommarskog, Stockholm, [EMAIL PROTECTED]