Perrin Harkins wrote:
On Fri, 2005-08-19 at 20:24 -0400, Christopher H. Laco wrote:I'm assuming that each tome dosomething() changes @contect, it's only changing @contect for that MP child process.Correct. However, dosomething() is a closure in your code, so @context will persist.
So, changing to package MyMod; my @context; sub dosomething { push @context; #...do other stuff.. }; sub pushcontext { push @context, shift; }; 1; Woudld fix the persistance issue?
Now, I need to have another module used in that same request, modify the context of the first...package MyMod; { my @context; sub dosomething { push @context; #...do other stuff.. }; sub pushcontext { push @context, shift; }; }; 1; package MyMod2; { my @context; sub dosomething { push @context; #...do other stuff.. MyMod::poshcontext('foo'); }; }; 1;Those are not referring to the same @context.
Corect, and that's intentional. Each module has it's own @context, but I need to have MoMod2 change it's own, as well as the one in MyMod..
Is that safe across requests?Define safe...
I want and changes to contect to only be applicable to the current request...
I'm assuming that MyMod is change MyMod2 in the same request/child process?No, I don't think so. They are two different variables named @context in different scopes.
Reverse that. MyMod2 is change it's @context, as well as calling MyMod and having MyMod change its context as well..
FOr that matter, what is the lifetime of my @context in that situation?Forever, since it's used in a closure. - Perrin
smime.p7s
Description: S/MIME Cryptographic Signature