On Fri, Apr 25, 2008 at 10:42:57PM -0700, Jan Dubois <jand@activestate.com> wrote: > What is the meaning of SvCUR() if your SV is just SvROK() and the PVX > slot contains a reference to another SV instead of a string buffer? It gives me CUR: > perl -MDevel::Peek -e "$a='foo'; $a=\$b; Dump $a" > CUR = 0 > SvCUR() is supposed to return the "length of the string in the SV", > but when SvPOK() is not set, then there is no string in the SV, so > the concept of a current length doesn't make any sense. Well, PV's can contain some memory pointer, a length and the currently used length of this memory range. Lots of modules upgrade to pv, grow to get some memory, and only then set svpok for example. > expect the semantics of SvCUR() to be in this case? Note that SvCUR() Just give me CUR. > is not actually the length of the string if you would print the SV, > which would print " SCALAR(0x182a32c)" and not the empty string "". You said there is no string in the pv, so how can it suddenly have a length? :) In any case, what I was pointing out that this simply was a regression. As I said, when perl changes the meaning of SvCUR from "accesses CUR" to "asserts unless some private flag is set", then I will happily oblige. I don't think this is a singular case, though, and I see no wrong ina cecssing the CUR slot of a PV when it exists. -- The choice of a Deliantra, the free code+content MORPG -----==- _GNU_ http://www.deliantra.net ----==-- _ generation ---==---(_)__ __ ____ __ Marc Lehmann --==---/ / _ \/ // /\ \/ / pcg@goof.com -=====/_/_//_/\_,_/ /_/\_\Thread Previous | Thread Next