2009/11/15 karl williamson <public@khwilliamson.com>: > I have been thinking somewhat of how to implement this. =A0The problem is= we > don't want to slow down things for this very rare (maybe non-existent) us= e. > =A0Since this feature is based on global subroutines, I would think one c= ould > store in a static variable if the existence of such a subroutine has been > looked for or not. =A0Then it could be structured so that the normal flow= had > just one test added to check this static. =A0For example, initialize the > static to 0 for not-looked at yet; set it to something else on the first > time the case function is called, say 1 if found no routine; and anything > else if found a routine. =A0There would have to be one variable for each = of > lc, uc, and ucfirst (since lcfirst uses the same case definitions as lc). > > Now, I'm not very familiar with Perl internals, so I'm asking. =A0I would > think we would not want to normally use statics just because of lexical > scoping and threads. =A0But in this case, there is no lexical scoping, an= d the > user-defined subroutines would apply to all threads. =A0So would a static > variable be an ok thing to use here?
No : because of embedding. (Perl interpreter(s) might be embedded in other programs, such as the vim editor for example)
The correct way to add a global variable is to add it to perlvars.h; and to add a per-interpreter variable, you have to add it to intrpvar.h. I think that in this case you want intrpvar.h.
|