Nicholas Clark wrote: > IIRC (confirmed by looking at hv.c) > > SvREADONLY on the hv makes the hash a restricted hash > (can't add new keys, can't access keys not present, can delete keys) From looking at my test script, in 5.6.1 it looks like readonlyness on a hash only prevented you from deleting, not from adding new keys. > SvREADONLY on a key also prevents it from being deleted. > > (as well as the regular effects of readonlyness) Umm, what exactly do you mean by 'regular'? Surely deletion is the only thing you can do to a hash key anyway? Do you mean it also makes the associated value readonly, or would that have to be set seperately? > I think that the implementation should have been marked "subject to change" > as it's not that clean. As well as the fact that it breaks existing code :-( FYI, the module in question is Sun::Solaris::Kstat, used by the Solaris-specific /bin/kstat command. It's more than a little inconvenient that this is broken between 5.6.1 and 5.8.2, as I have to ship both perl versions in Solaris 10. When 'restricted hashes' were added did anyone check that XSUB code which uses them still behaves sensibly on older versions of perl? You always could SvREADONLY_on/off on hashes in 5.6.1, it's unfortunate that the restricted hashes stuff has broken older code. -- Alan Burlison --Thread Previous | Thread Next