in reply to Re: Re: safe and $self
in thread safe and $self

I think, like what fever said, that you've painted yourself in to a corner with this. $self is a lexical variable, in other words, it doesn't really exist outside of the codewrapper function, those seven lines.

The real problem is if you are ever calling the codewrapper function within itself. Then you're going to have trouble sharing the correct $self since there will, at that point, be two of them.

The solution might be to not use Safe at all. It might be best to re-engineer your application, since using eval, and presumably reval are much slower than the alternatives.

If this isn't going to work, then what you're probably going to have to do is create separate compartments for each object. I'm not sure if there's an easy way to do this or not.