At 10:47 AM 5/4/2001 -0400, Benjamin Sugars wrote:
>On Fri, 4 May 2001, Dan Sugalski wrote:
>
> > Just make sure that it's *really* readonly. That means no
> > stringification/numification after the flag is set.
>
>Is there another flag differnt from SvREADONLY that ensures this?  Or is
>it up to the programmer to avoid stringification/numification?

There's no flag that I can see. Perl will happily upgrade a readonly 
scalar, which is decidedly non-threadsafe.

The only safe thing to do for this is to make sure the scalar is upgraded 
first. I'd go either to SVt_PVNV or all the way to SVt_PVMG. The magic 
form's generally unnecessary (and a bit big), but if someone tries to 
lock() on the variable then lock will upgrade it anyway.

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to