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

So I take it $self->{code} contains a reference to an instance of Safe. Again, if $test is declared using my, it is a lexical variable and hence cannot be shared with the code inside of the compartment. See these nodes for more on dynamic versus lexical variables: What's the difference between dynamic and lexical (static) scoping? Between local() and my()? and Lexical vs. Package Variables (With a little local thrown in).